Git 如何通过bitbucker pielines自动构建并将许多docker映像推送到ecr?
我对Bitbucket的回购看起来:Git 如何通过bitbucker pielines自动构建并将许多docker映像推送到ecr?,git,docker,continuous-integration,bitbucket,bitbucket-pipelines,Git,Docker,Continuous Integration,Bitbucket,Bitbucket Pipelines,我对Bitbucket的回购看起来: Project |-dir1 |-dir2 |-docker_apps |-app1_dir |-some_data1 |-source_code1 |-dockerfile |-app2_dir |-some_data2 |-source_code2 |-dockerfile |-app3_dir |-some_data3 |-source_code3 |-dockerfile |-dir4 |-tes
Project
|-dir1
|-dir2
|-docker_apps
|-app1_dir
|-some_data1
|-source_code1
|-dockerfile
|-app2_dir
|-some_data2
|-source_code2
|-dockerfile
|-app3_dir
|-some_data3
|-source_code3
|-dockerfile
|-dir4
|-tests
|bitbucket-pipelines
我能达到什么
image: python
pipelines:
tags:
ecr-*:
- step:
services:
- docker
script:
- pip3 install aws-cli
- IMAGE="<image_uri>/app1"
- TAG=${BITBUCKET_BRANCH:-$BITBUCKET_TAG}
- aws configure set aws_access_key_id "${AWS_KEY}"
- aws configure set aws_secret_access_key "${AWS_SECRET}"
- eval $(aws ecr get-login --no-include-email --region ap-southeast-1
- docker build -t $IMAGE:$TAG .
- docker push $IMAGE:$TAG
image:python
管道:
标签:
ecr-*:
-步骤:
服务:
-码头工人
脚本:
-pip3安装aws cli
-IMAGE=“/app1”
-TAG=${BITBUCKET\u分支:-$BITBUCKET\u TAG}
-aws配置设置aws\u访问\u密钥\u id“${aws\u密钥}”
-aws配置设置aws\u密码\u访问\u密钥“${aws\u密码}”
-eval$(aws ecr get登录--不包括电子邮件--地区ap-Southwest-1
-docker构建-t$IMAGE:$TAG。
-docker推送$IMAGE:$TAG
如果我理解好的话-是针对特定的图像的。我如何创建管道来在提交bitbucket中的特定目录后构建和推送图像?我的意思是,如果有人合并了app2\u目录,它将被构建并推送到ecr。下一步,如果有人合并了app3\u目录,则相同…等等
也许有更好的选择来完成这项任务?我对CI/CD一无所知,所以如果有人有另一个更好的解决方案,也会很棒