Skip to content

Commit 716db9e

Browse files
authored
Avoid second build in docker/build-push-action@v6
1 parent 3e2bc12 commit 716db9e

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

.github/workflows/build-docker-artifacts.yml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -271,38 +271,8 @@ jobs:
271271
continue-on-error: false
272272

273273
- name: Push image
274-
uses: docker/build-push-action@v6
275-
with:
276-
context: .
277-
file: ${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}/Dockerfile
278-
push: true
279-
# Disable provenance as it creates weird multi-arch images: https://github.com/docker/build-push-action/issues/755
280-
provenance: false
281-
# Duplicated the build-args, secrets, tags and labels from the actual build above
282-
# TODO: How can we avoid the build here and just push with this action?
283-
build-args: |
284-
DOCKERFILE_DIRECTORY=${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}
285-
PYTHON_BASE_IMAGE=${{ env.PYTHON_BASE_IMAGE }}
286-
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
287-
NODE_BASE_IMAGE=${{ env.NODE_BASE_IMAGE }}
288-
DATAVISYN_NGINX_BASE_IMAGE=${{ env.DATAVISYN_NGINX_BASE_IMAGE }}
289-
secrets:
290-
# Mount the token as secret mount: https://docs.docker.com/build/ci/github-actions/secrets/#secret-mounts
291-
"github_token=${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}"
292-
# TODO: As soon as we only have a single tag, we can push the same image to multiple repositories: https://docs.docker.com/build/ci/github-actions/push-multi-registries/
293-
# This will be useful for the images which don't change between flavors, e.g. the backend images
294-
tags: |
295-
${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
296-
labels: |
297-
name=${{ matrix.component.ecr_repository }}
298-
version=${{ matrix.component.image_tag_branch_name }}
299-
org.opencontainers.image.description=Image for ${{ matrix.component.ecr_repository }}
300-
org.opencontainers.image.source=${{ github.event.repository.html_url }}
301-
org.opencontainers.image.url=${{ github.event.repository.html_url }}
302-
org.opencontainers.image.title=${{ matrix.component.ecr_repository }}
303-
org.opencontainers.image.version=${{ matrix.component.image_tag_branch_name }}
304-
org.opencontainers.image.created=${{ matrix.component.build_time }}
305-
org.opencontainers.image.revision=${{ github.sha }}
274+
# Instead of the docker/build-push-action@v6 which will rebuild the image, just push it directly
275+
run: docker push ${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
306276

307277
- name: Log out from Amazon ECR
308278
shell: bash

0 commit comments

Comments
 (0)