From 311418b1e080a780ed178268041b254b2de4e4a7 Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Tue, 26 Nov 2024 18:05:13 +0100 Subject: [PATCH 1/2] fix publishing of multi arch image --- justfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index 07ae8f4..bfe00be 100644 --- a/justfile +++ b/justfile @@ -38,7 +38,16 @@ build-setup: # Use oci-mediatypes=false to improve compatibility with older docker versions, e.g. <= 19.0.x # See https://github.com/docker/buildx/issues/1964#issuecomment-1644634461 build OUTPUT_TYPE=DEFAULT_OUTPUT_TYPE VERSION='latest': build-setup - docker buildx build --build-arg "TEDGE_IMAGE={{TEDGE_IMAGE}}" --build-arg "TEDGE_TAG={{TEDGE_TAG}}" -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:{{VERSION}}" -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:latest" -f Dockerfile --output=type="{{OUTPUT_TYPE}}",oci-mediatypes=false --provenance=false . + docker buildx build \ + --platform linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64 \ + --build-arg "TEDGE_IMAGE={{TEDGE_IMAGE}}" \ + --build-arg "TEDGE_TAG={{TEDGE_TAG}}" \ + -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:{{VERSION}}" \ + -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:latest" \ + -f Dockerfile \ + --output=type="{{OUTPUT_TYPE}}",oci-mediatypes=false \ + --provenance=false \ + . # Install python virtual environment venv: From cd02d19aa415fef17e467eed6a8b0885d426b28d Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Tue, 26 Nov 2024 18:08:36 +0100 Subject: [PATCH 2/2] add container version label --- .github/workflows/publish.yaml | 4 +++- justfile | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c248c10..3a42d1a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -23,6 +23,8 @@ jobs: - name: Setup Docker buildx uses: docker/setup-buildx-action@v3 + with: + install: true - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -34,4 +36,4 @@ jobs: - uses: taiki-e/install-action@just - name: Publish images - run: just build registry ${{ inputs.VERSION || github.ref_name }} + run: just publish registry ${{ inputs.VERSION || github.ref_name }} diff --git a/justfile b/justfile index bfe00be..8c8a5e0 100644 --- a/justfile +++ b/justfile @@ -30,16 +30,29 @@ build-setup: docker buildx install docker run --privileged --rm tonistiigi/binfmt --install all +# Build docker images (for testing) +build OUTPUT_TYPE=DEFAULT_OUTPUT_TYPE VERSION='latest': build-setup + docker buildx build \ + --label "org.opencontainers.image.version={{VERSION}}" \ + --build-arg "TEDGE_IMAGE={{TEDGE_IMAGE}}" \ + --build-arg "TEDGE_TAG={{TEDGE_TAG}}" \ + -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:{{VERSION}}" \ + -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:latest" \ + -f Dockerfile \ + --output=type="{{OUTPUT_TYPE}}",oci-mediatypes=false \ + --provenance=false \ + . -# Build the docker images +# Publish docker images (multi-arch) # Example: -# just build registry latest -# just build registry 1.2.0 +# just publish registry latest +# just publish registry 1.2.0 # Use oci-mediatypes=false to improve compatibility with older docker versions, e.g. <= 19.0.x # See https://github.com/docker/buildx/issues/1964#issuecomment-1644634461 -build OUTPUT_TYPE=DEFAULT_OUTPUT_TYPE VERSION='latest': build-setup +publish OUTPUT_TYPE=DEFAULT_OUTPUT_TYPE VERSION='latest': build-setup docker buildx build \ --platform linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64 \ + --label "org.opencontainers.image.version={{VERSION}}" \ --build-arg "TEDGE_IMAGE={{TEDGE_IMAGE}}" \ --build-arg "TEDGE_TAG={{TEDGE_TAG}}" \ -t "{{REGISTRY}}/{{REPO_OWNER}}/{{IMAGE}}:{{VERSION}}" \