我在将 docker 映像部署到AWS LightSail. 我在 GitLab 上使用私有容器,我的图像在构建后推送到那里。我为 ci/cd 创建了第二阶段,用于将映像部署到 Lightsail。
image: docker:19.03.12
services:
- docker:19.03.12-dind
build:
stage: build
before_script:
- docker login registry.gitlab.com --username $UserName -p $CiCdToken
script:
- docker build -t registry.gitlab.com/nickname/testprojectname .
- docker push registry.gitlab.com/nickname/testprojectname
deploy:
stage: deploy
image: python:latest
script:
- pip install awscli
- pip install lightsailctl
- aws lightsail push-container-image --service-name testprojectname --label testprojectname --image registry.gitlab.com/nickname/testprojectname
Run Code Online (Sandbox Code Playgroud)
不幸的是Python没有lightsailctl和awscli不支持lightsail。
lightsailaws ctlvia runner。 …amazon-web-services gitlab docker gitlab-ci-runner amazon-lightsail