Skip to content

Commit

Permalink
add container version label
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Nov 26, 2024
1 parent 311418b commit cd02d19
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
21 changes: 17 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}}" \
Expand Down

0 comments on commit cd02d19

Please sign in to comment.