Skip to content

Commit

Permalink
Test build multiplatform images
Browse files Browse the repository at this point in the history
  • Loading branch information
groldan committed Oct 1, 2024
1 parent 4db8901 commit a63fe6a
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 15 deletions.
144 changes: 144 additions & 0 deletions .github/workflows/build-and-push-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Build and Push multi-platform Docker images
on:
push:
branches:
- main
- "release/**"
- "docker/**"
paths:
- "Makefile"
- "pom.xml"
- ".github/workflows/build-and-push-images.yaml"
- "config"
- "src/**"
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
base-jre:
name: JRE 21 base image
runs-on: ubuntu-latest
if: |
github.repository == 'geoserver/geoserver-cloud'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
install: true # make buildx an alias for build
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
context: ./src/apps/base-images/jre
tags: geoservercloud/jre:21

jre-gdal:
name: GDAL-JNI base image
runs-on: ubuntu-latest
timeout-minutes: 120
needs: base-jre
if: |
github.repository == 'geoserver/geoserver-cloud'
&& (needs.base-jre.result == 'success' || needs.base-jre.result == 'skipped')
&& false
steps:
- run: echo "TBD"

infra:
name: Infrastructure services
runs-on: ubuntu-latest
needs: base-jre
if: |
github.repository == 'geoserver/geoserver-cloud'
&& (needs.base-jre.result == 'success' || needs.base-jre.result == 'skipped')
&& false
steps:
- run: echo "TBD"

geoserver:
name: GeoServer services
runs-on: ubuntu-latest
needs: jre-gdal
if: |
github.repository == 'geoserver/geoserver-cloud'
&& always()
&& (needs.jre-gdal.result == 'success' || needs.jre-gdal.result == 'skipped')
strategy:
fail-fast: false
matrix:
include:
- context: ./src/apps/base-images/geoserver
image: geoservercloud/gs-cloud-base-geoserver-image
- context: ./src/apps/geoserver/wms
image: geoservercloud/geoserver-cloud-wms
- context: ./src/apps/geoserver/wfs
image: geoservercloud/geoserver-cloud-wfs
- context: ./src/apps/geoserver/wcs
image: geoservercloud/geoserver-cloud-wcs
- context: ./src/apps/geoserver/wps
image: geoservercloud/geoserver-cloud-wps
- context: ./src/apps/geoserver/gwc
image: geoservercloud/geoserver-cloud-gwc
- context: ./src/apps/geoserver/restconfig
image: geoservercloud/geoserver-cloud-rest
- context: ./src/apps/geoserver/webui
image: geoservercloud/geoserver-cloud-webui
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
install: true # make buildx an alias for build

- name: Create packaged applications
run: |
./mvnw clean package -DskipTests -U -ntp -T1C -am \
-pl :gs-cloud-base-geoserver-image,:gs-cloud-gwc,:gs-cloud-restconfig-v1,:gs-cloud-wcs,:gs-cloud-wfs,:gs-cloud-wms,:gs-cloud-wps,:gs-cloud-webui
- name: Resolve tag for docker images
run: echo "TAG=$(./mvnw help:evaluate -q -DforceStdout -Dexpression=project.version)" >> $GITHUB_ENV

- name: Build and push GeoServer Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: ${{ matrix.context }}
#file:
push: true
tags: ${{ matrix.image }}:${{ env.TAG }}
#labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,36 @@ jobs:
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

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

- 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: 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: Validate source code formatting
run: make lint

Expand Down
5 changes: 2 additions & 3 deletions src/apps/base-images/geoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 as builder
ARG JAR_FILE=target/gs-cloud-*-bin.jar

RUN apt update && apt install -y --no-install-recommends unzip
Expand All @@ -13,7 +12,7 @@ RUN java -Djarmode=layertools -jar application.jar extract
# rm /tmp/YourKit-JavaProfiler-2023.9-docker.zip

##########
FROM geoservercloud/gs-cloud-base-spring-boot:$TAG
FROM geoservercloud/jre:21

# init
RUN apt update \
Expand Down
2 changes: 1 addition & 1 deletion src/apps/base-images/spring-boot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/gs-cloud-base-jre:$TAG AS builder
ARG JAR_FILE=target/gs-cloud-*-bin.jar

COPY ${JAR_FILE} application.jar
Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/gwc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/restconfig/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/wcs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/webui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/wfs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/wms/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down
2 changes: 1 addition & 1 deletion src/apps/geoserver/wps/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
FROM geoservercloud/jre:21 AS builder

ARG JAR_FILE=target/gs-cloud-*-bin.jar

Expand Down

0 comments on commit a63fe6a

Please sign in to comment.