Build geoserver apps docker images in parallel

This commit is contained in:
Gabriel Roldan 2025-10-01 20:59:57 -03:00
parent efbe292174
commit df79d3c103
No known key found for this signature in database
GPG Key ID: 697E8F9DF72128E1
15 changed files with 53 additions and 31 deletions

View File

@ -71,7 +71,7 @@ jobs:
infrastructure-images: infrastructure-images:
needs: base-images needs: base-images
if: github.repository == 'geoserver/geoserver-cloud' if: github.repository == 'geoserver/geoserver-cloud'
name: Build and Push Infrastructure Images name: Build infrastructure images
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
@ -118,9 +118,14 @@ jobs:
geoserver-images: geoserver-images:
needs: base-images needs: base-images
if: github.repository == 'geoserver/geoserver-cloud' if: github.repository == 'geoserver/geoserver-cloud'
name: Build and Push GeoServer Images name: Build GeoServer image
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# matches app folder names in src/apps/geoserver/* and docker compose service names
app: [ 'wms', 'wfs', 'wcs', 'wps', 'gwc', 'restconfig', 'webui' ]
steps: steps:
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
@ -151,11 +156,11 @@ jobs:
- name: Package GeoServer apps - name: Package GeoServer apps
run: | run: |
make package-geoserver-images ./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/geoserver/${{ matrix.app }}
- name: Build and push GeoServer images - name: Build and push GeoServer images
run: | run: |
make build-image-geoserver-multiplatform REPACKAGE=false make build-image-geoserver-multiplatform ${{ matrix.app }}
- name: Clean up Maven project artifacts - name: Clean up Maven project artifacts
run: | run: |
@ -188,10 +193,7 @@ jobs:
- name: Pull all images - name: Pull all images
run: | run: |
TAG=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) make pull-images
for image in config discovery gateway gwc rest wcs webui wfs wms wps; do
docker pull geoservercloud/geoserver-cloud-$image:$TAG
done
- name: Install Cosign - name: Install Cosign
uses: sigstore/cosign-installer@v3.5.0 uses: sigstore/cosign-installer@v3.5.0

View File

@ -71,10 +71,13 @@ build-image-infrastructure: package-infrastructure-images
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \ COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/infrastructure.yml build docker compose -f docker-build/infrastructure.yml build
# This uses $(MAKECMDGOALS) (all targets specified) and filters out the target itself ($@), passing the rest as arguments. The %: rule tells make to ignore any unrecognized "targets" (which are actually your service names).
# Then you can call:
# make build-image-geoserver wcs wfs
.PHONY: build-image-geoserver .PHONY: build-image-geoserver
build-image-geoserver: package-geoserver-images build-image-geoserver: package-geoserver-images
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \ COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/geoserver.yml build docker compose -f docker-build/geoserver.yml build $(filter-out $@ build-image build-image-multiplatform,$(MAKECMDGOALS))
.PHONY: build-image-multiplatform .PHONY: build-image-multiplatform
build-image-multiplatform: build-base-images-multiplatform build-image-infrastructure-multiplatform build-image-geoserver-multiplatform build-image-multiplatform: build-base-images-multiplatform build-image-infrastructure-multiplatform build-image-geoserver-multiplatform
@ -97,15 +100,18 @@ build-image-infrastructure-multiplatform: package-infrastructure-images
TAG=$(TAG) \ TAG=$(TAG) \
docker compose -f docker-build/infrastructure-multiplatform.yml build --push docker compose -f docker-build/infrastructure-multiplatform.yml build --push
# This uses $(MAKECMDGOALS) (all targets specified) and filters out the target itself ($@), passing the rest as arguments. The %: rule tells make to ignore any unrecognized "targets" (which are actually your service names).
# Then you can call:
# make build-image-geoserver-multiplatform wcs wfs
.PHONY: build-image-geoserver-multiplatform .PHONY: build-image-geoserver-multiplatform
build-image-geoserver-multiplatform: package-geoserver-images build-image-geoserver-multiplatform: package-geoserver-images
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 TAG=$(TAG) \ COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 TAG=$(TAG) \
docker compose -f docker-build/geoserver-multiplatform.yml build --push docker compose -f docker-build/geoserver-multiplatform.yml build --push $(filter-out $@ build-image build-image-multiplatform,$(MAKECMDGOALS))
.PHONY: package-base-images .PHONY: package-base-images
package-base-images: package-base-images:
ifeq ($(REPACKAGE), true) ifeq ($(REPACKAGE), true)
./mvnw clean package -DskipTests -T1C -nsu -am -pl src/apps/base-images/jre,src/apps/base-images/spring-boot,src/apps/base-images/spring-boot3,src/apps/base-images/geoserver ./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/base-images/jre,src/apps/base-images/spring-boot,src/apps/base-images/spring-boot3,src/apps/base-images/geoserver
else else
@echo "Not re-packaging base images, assuming the target/*-bin.jar files exist" @echo "Not re-packaging base images, assuming the target/*-bin.jar files exist"
endif endif
@ -113,7 +119,7 @@ endif
.PHONY: package-infrastructure-images .PHONY: package-infrastructure-images
package-infrastructure-images: package-infrastructure-images:
ifeq ($(REPACKAGE), true) ifeq ($(REPACKAGE), true)
./mvnw clean package -DskipTests -T1C -nsu -am -pl src/apps/infrastructure/config,src/apps/infrastructure/discovery,src/apps/infrastructure/gateway ./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/infrastructure/config,src/apps/infrastructure/discovery,src/apps/infrastructure/gateway
else else
@echo "Not re-packaging infra images, assuming the target/*-bin.jar files exist" @echo "Not re-packaging infra images, assuming the target/*-bin.jar files exist"
endif endif
@ -121,15 +127,24 @@ endif
.PHONY: package-geoserver-images .PHONY: package-geoserver-images
package-geoserver-images: package-geoserver-images:
ifeq ($(REPACKAGE), true) ifeq ($(REPACKAGE), true)
./mvnw clean package -DskipTests -T1C -nsu -am -pl src/apps/geoserver/gwc,src/apps/geoserver/restconfig,src/apps/geoserver/wcs,src/apps/geoserver/webui,src/apps/geoserver/wfs,src/apps/geoserver/wms,src/apps/geoserver/wcs,src/apps/geoserver/wps ./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/geoserver/gwc,src/apps/geoserver/restconfig,src/apps/geoserver/wcs,src/apps/geoserver/webui,src/apps/geoserver/wfs,src/apps/geoserver/wms,src/apps/geoserver/wcs,src/apps/geoserver/wps
else else
@echo "Not re-packaging geoserver images, assuming the target/*-bin.jar files exist" @echo "Not re-packaging geoserver images, assuming the target/*-bin.jar files exist"
endif endif
.PHONY: pull-images
pull-images:
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) \
docker compose \
-f docker-build/geoserver-multiplatform.yml \
-f docker-build/infrastructure-multiplatform.yml \
pull --quiet
.PHONY: sign-image .PHONY: sign-image
sign-image: sign-image:
@bash -c '\ @bash -c '\
images=$$(docker images --format "{{.Repository}}@{{.Digest}}" | grep "geoserver-cloud-"); \ TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout); \
images=$$(TAG=$$TAG docker compose -f docker-build/geoserver-multiplatform.yml -f docker-build/infrastructure-multiplatform.yml config --images); \
for image in $$images; do \ for image in $$images; do \
echo "Signing $$image"; \ echo "Signing $$image"; \
output=$$(cosign sign --yes --key env://COSIGN_KEY --recursive $$image 2>&1); \ output=$$(cosign sign --yes --key env://COSIGN_KEY --recursive $$image 2>&1); \
@ -144,7 +159,8 @@ sign-image:
.PHONY: verify-image .PHONY: verify-image
verify-image: verify-image:
@bash -c '\ @bash -c '\
images=$$(docker images --format "{{.Repository}}@{{.Digest}}" | grep "geoserver-cloud-"); \ TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout); \
images=$$(TAG=$$TAG docker compose -f docker-build/geoserver-multiplatform.yml -f docker-build/infrastructure-multiplatform.yml config --images); \
for image in $$images; do \ for image in $$images; do \
echo "Verifying $$image"; \ echo "Verifying $$image"; \
output=$$(cosign verify --key env://COSIGN_PUB_KEY $$image 2>&1); \ output=$$(cosign verify --key env://COSIGN_PUB_KEY $$image 2>&1); \
@ -204,3 +220,7 @@ run-acceptance-tests-jdbcconfig:
.PHONY: clean-acceptance-tests-jdbcconfig .PHONY: clean-acceptance-tests-jdbcconfig
clean-acceptance-tests-jdbcconfig: clean-acceptance-tests-jdbcconfig:
(cd compose/ && ./acceptance_jdbcconfig down -v) (cd compose/ && ./acceptance_jdbcconfig down -v)
# Prevent make from treating service names as targets when using $(MAKECMDGOALS) in build-image-geoserver/build-image-geoserver-multiplatform
%:
@:

View File

@ -19,7 +19,7 @@ services:
condition: service_healthy condition: service_healthy
gwc: gwc:
condition: service_healthy condition: service_healthy
rest: restconfig:
condition: service_healthy condition: service_healthy
#webui: #webui:
# condition: service_started # condition: service_started
@ -89,7 +89,7 @@ services:
memory: 512M memory: 512M
healthcheck: healthcheck:
retries: 20 retries: 20
rest: restconfig:
deploy: deploy:
resources: resources:
limits: limits:

View File

@ -53,7 +53,7 @@ services:
volumes: *geoserver_volumes volumes: *geoserver_volumes
depends_on: *gs-dependencies depends_on: *gs-dependencies
rest: restconfig:
environment: *geoserver_environment environment: *geoserver_environment
volumes: *geoserver_volumes volumes: *geoserver_volumes
depends_on: *gs-dependencies depends_on: *gs-dependencies

View File

@ -54,7 +54,7 @@ services:
volumes: *geoserver_volumes volumes: *geoserver_volumes
depends_on: *gs-dependencies depends_on: *gs-dependencies
rest: restconfig:
environment: *geoserver_environment environment: *geoserver_environment
volumes: *geoserver_volumes volumes: *geoserver_volumes
depends_on: *gs-dependencies depends_on: *gs-dependencies

View File

@ -24,7 +24,7 @@ services:
environment: *geoserver_environment environment: *geoserver_environment
depends_on: *gs-dependencies depends_on: *gs-dependencies
rest: restconfig:
environment: *geoserver_environment environment: *geoserver_environment
depends_on: *gs-dependencies depends_on: *gs-dependencies

View File

@ -164,7 +164,7 @@ services:
cpus: '4.0' cpus: '4.0'
memory: 2G memory: 2G
rest: restconfig:
extends: extends:
file: templates.yml file: templates.yml
service: gstemplate service: gstemplate

View File

@ -20,7 +20,7 @@ services:
wcs: wcs:
ports: ports:
- 9103:8080 - 9103:8080
rest: restconfig:
ports: ports:
- 9105:8080 - 9105:8080
webui: webui:

View File

@ -80,7 +80,7 @@ services:
condition: service_healthy condition: service_healthy
required: true required: true
rest: restconfig:
environment: environment:
SPRING_PROFILES_INCLUDE: "standalone" SPRING_PROFILES_INCLUDE: "standalone"
depends_on: depends_on:

2
config

@ -1 +1 @@
Subproject commit b8089b73e94341c90ea8da28e08461bbd7e762e6 Subproject commit 352ebfb33250903dc55b4961c614d17dac2e8110

View File

@ -31,7 +31,7 @@ services:
build: build:
context: ../src/apps/geoserver/wps/ context: ../src/apps/geoserver/wps/
rest: restconfig:
extends: extends:
file: templates.yml file: templates.yml
service: multi-platform service: multi-platform

View File

@ -31,7 +31,7 @@ services:
build: build:
context: ../src/apps/geoserver/wps/ context: ../src/apps/geoserver/wps/
rest: restconfig:
extends: extends:
file: templates.yml file: templates.yml
service: current-platform service: current-platform

View File

@ -143,7 +143,7 @@ services:
deploy: deploy:
replicas: 1 replicas: 1
rest: restconfig:
image: geoservercloud/geoserver-cloud-rest:2.27.2.0 image: geoservercloud/geoserver-cloud-rest:2.27.2.0
extends: extends:
service: geoserver_template service: geoserver_template

View File

@ -157,7 +157,7 @@ services:
deploy: deploy:
replicas: 1 replicas: 1
rest: restconfig:
image: geoservercloud/geoserver-cloud-rest:2.27.2.0 image: geoservercloud/geoserver-cloud-rest:2.27.2.0
extends: extends:
service: geoserver_template service: geoserver_template

View File

@ -262,7 +262,7 @@ services:
deploy: deploy:
replicas: 1 replicas: 1
rest: restconfig:
image: geoservercloud/geoserver-cloud-rest:2.27.2.0 image: geoservercloud/geoserver-cloud-rest:2.27.2.0
extends: extends:
service: geoserver_template service: geoserver_template