9191 aws-access-key-id : ${{ env.AWS_ACCESS_KEY }}
9292 aws-secret-access-key : ${{ env.AWS_SECRET_KEY }}
9393 aws-region : ${{ inputs.aws-region }}
94- - name : Set up QEMU
95- uses : docker/setup-qemu-action@v3
96- with :
97- platforms : ${{ inputs.platforms }}
98- - name : Set up Docker Buildx
99- uses : docker/setup-buildx-action@v3
10094 - name : Expand tags with ECR url and ECR repo
10195 id : expand_tags
10296 env :
@@ -114,19 +108,33 @@ runs:
114108 echo EOF
115109 } >> "$GITHUB_ENV"
116110 echo "REPO=$REPO" >> "$GITHUB_ENV"
117- - name : Build and push Docker images
118- uses : docker/build-push-action@v6
119- id : build_push
120- with :
121- file : ${{ inputs.container-file }}
122- context : ${{ inputs.build-context }}
123- push : ${{ inputs.push-image }}
124- tags : ${{ env.EXPANDED_TAGS }}
125- build-args : ${{ inputs.build-args }}
126- platforms : ${{ inputs.platforms }}
127- cache-from : type=registry,ref=${{ inputs.ecr-url }}/${{ env.REPO }}:buildcache
128- cache-to : mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=${{ inputs.ecr-url }}/${{ env.REPO }}:buildcache
129- labels : ${{ inputs.labels }}
130- secrets : ${{ inputs.secrets }}
131- secret-envs : ${{ inputs.secret-envs }}
132- provenance : ${{ inputs.provenance }}
111+
112+ - name : Build and push Docker images (legacy)
113+ shell : bash
114+ env :
115+ CONTAINERFILE : ${{ inputs.container-file }}
116+ BUILD_CONTEXT : ${{ inputs.build-context }}
117+ BUILD_ARGS : ${{ inputs.build-args }}
118+ ECR_URL : ${{ inputs.ecr-url }}
119+ AWS_REGION : ${{ inputs.aws-region }}
120+ run : |
121+ # Login to ECR
122+ aws ecr get-login-password --region $AWS_REGION | \
123+ docker login --username AWS --password-stdin $ECR_URL
124+
125+ # Parse build args
126+ DOCKER_BUILD_ARGS=""
127+ if [ -n "$BUILD_ARGS" ]; then
128+ while IFS= read -r arg; do
129+ [ -n "$arg" ] && DOCKER_BUILD_ARGS="$DOCKER_BUILD_ARGS --build-arg $arg"
130+ done <<< "$BUILD_ARGS"
131+ fi
132+
133+ # Build and push each tag
134+ for TAG in $EXPANDED_TAGS; do
135+ docker build -f $CONTAINERFILE \
136+ $DOCKER_BUILD_ARGS \
137+ -t $TAG \
138+ $BUILD_CONTEXT
139+ docker push $TAG
140+ done
0 commit comments