Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker buildx to build multi-platform images #941

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 40 additions & 19 deletions .github/workflows/on_release_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,42 +161,63 @@ jobs:
env:
DOCKERHUB_ORG: gospatial
DOCKERHUB_REPO: tegola
BUILD_ARGS: |
BUILDPKG=${BUILD_PKG}
VER=${VERSION}
BRANCH=${GIT_BRANCH}
REVISION=${GIT_REVISION}

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Setup env
uses: ./.github/actions/tegola-setup-env
with:
ui: true

- name: Build and tag Docker container
- name: Build and export to Docker
uses: docker/build-push-action@v4
with:
context: .
load: true
platforms: linux/amd64
ARolek marked this conversation as resolved.
Show resolved Hide resolved
build-args: ${{ env.BUILD_ARGS }}
tags: ${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }}

- name: Test
manastyretskyi marked this conversation as resolved.
Show resolved Hide resolved
run: |
docker build -t tegola --build-arg BUILDPKG=${BUILD_PKG} --build-arg VER=${VERSION} --build-arg BRANCH=${GIT_BRANCH} --build-arg REVISION=${GIT_REVISION} .
docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION}
docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:latest
docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:edge
docker run --rm tegola version
docker run --rm ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION} version

- name: Publish Docker edge container
if: github.ref == env.DEFAULT_BRANCH_REF
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USER} --password-stdin
docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:edge
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:edge
platforms: linux/amd64,linux/arm64
build-args: ${{ env.BUILD_ARGS }}

- name: Publish Docker container
if: github.event_name == 'release'
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USER} --password-stdin
docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION}
docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:latest
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }},${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:latest
platforms: linux/amd64,linux/arm64
build-args: ${{ env.BUILD_ARGS }}

build_windows:
name: Build for Windows
Expand Down