Skip to content

Commit

Permalink
Multiarch Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Aug 26, 2024
1 parent 97e95a7 commit 89ed56f
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 5 deletions.
77 changes: 74 additions & 3 deletions .github/workflows/builld-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,31 @@ concurrency:
group: docker
cancel-in-progress: true

env:
REGISTRY_IMAGE: ghcr.io/ogcincubator/chek-data-completeness

jobs:
docker:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64

steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
- name: Set up Docker ºBuildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
Expand All @@ -35,18 +48,76 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/ogcincubator/chek-data-completeness
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=tag
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You may also create a `.env` file with the [configuration](#configuration) inste
val3dity and CityGML tools come prepackaged in the Docker image, so no dependencies are required.

```
docker run -p 8080:8080 ghcr.io/ogcincubator/chek-data-completeness
docker run --pull=always -p 8080:8080 ghcr.io/ogcincubator/chek-data-completeness
```

The service will be available at https://localhost:8080.
Expand All @@ -52,7 +52,7 @@ If you need to serve the application from a path other than `/`, you can pass it
variable:

```
docker run -p 8080:8080 -e ROOT_PATH=/my-subpath/ ghcr.io/ogcincubator/chek-data-completeness
docker run --pull=always -p 8080:8080 -e ROOT_PATH=/my-subpath/ ghcr.io/ogcincubator/chek-data-completeness
```

## Configuration
Expand Down

0 comments on commit 89ed56f

Please sign in to comment.