Skip to content

Commit

Permalink
Merge pull request #76 from groldan/build/multiplatform-image
Browse files Browse the repository at this point in the history
Build multiplatform docker image for the API service
  • Loading branch information
groldan authored Sep 30, 2024
2 parents 8b2001c + 5d3cb37 commit 1afe553
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions .github/workflows/build-and-push-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,45 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Validate source code formatting
run: |
make lint
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

# Add support for more platforms with QEMU
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Make package
run: |
make package
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# https://github.com/docker/setup-buildx-action
with:
platforms: linux/amd64,linux/arm64
# Sets up docker build command as an alias to docker buildx
install: true

- name: Build docker image
run: |
make build-image
- name: Package
run: ./mvnw clean package -DskipTests -U -ntp -pl :gs-acl-service -am

- name: Push docker image
run: |
make push-image
- name: Set version tag
run: echo "TAG=$(./mvnw help:evaluate -q -DforceStdout -Dexpression=project.version)" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
context: ./src/artifacts/api
tags: geoservercloud/geoserver-acl:${{ env.TAG }}

0 comments on commit 1afe553

Please sign in to comment.