Skip to content

Commit 1762af6

Browse files
authored
fix: trivy scan breaking image push
1 parent ab44fd4 commit 1762af6

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,36 @@ jobs:
255255
- name: Push image
256256
uses: docker/build-push-action@v6
257257
with:
258+
context: .
258259
file: ${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}/Dockerfile
259260
push: true
261+
# Disable provenance as it creates weird multi-arch images: https://github.com/docker/build-push-action/issues/755
260262
provenance: false
261-
context: .
263+
# Duplicated the build-args, secrets, tags and labels from the actual build above
264+
# TODO: How can we avoid the build here and just push with this action?
265+
build-args: |
266+
DOCKERFILE_DIRECTORY=${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}
267+
PYTHON_BASE_IMAGE=${{ env.PYTHON_BASE_IMAGE }}
268+
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
269+
NODE_BASE_IMAGE=${{ env.NODE_BASE_IMAGE }}
270+
DATAVISYN_NGINX_BASE_IMAGE=${{ env.DATAVISYN_NGINX_BASE_IMAGE }}
271+
secrets:
272+
# Mount the token as secret mount: https://docs.docker.com/build/ci/github-actions/secrets/#secret-mounts
273+
"github_token=${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}"
274+
# 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/
275+
# This will be useful for the images which don't change between flavors, e.g. the backend images
262276
tags: |
263277
${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
278+
labels: |
279+
name=${{ matrix.component.ecr_repository }}
280+
version=${{ matrix.component.image_tag_branch_name }}
281+
org.opencontainers.image.description=Image for ${{ matrix.component.ecr_repository }}
282+
org.opencontainers.image.source=${{ github.event.repository.html_url }}
283+
org.opencontainers.image.url=${{ github.event.repository.html_url }}
284+
org.opencontainers.image.title=${{ matrix.component.ecr_repository }}
285+
org.opencontainers.image.version=${{ matrix.component.image_tag_branch_name }}
286+
org.opencontainers.image.created=${{ matrix.component.build_time }}
287+
org.opencontainers.image.revision=${{ github.sha }}
264288
265289
- name: Log out from Amazon ECR
266290
shell: bash

0 commit comments

Comments
 (0)