Skip to content

Commit 3b987f8

Browse files
committed
Build geoserver apps docker images in parallel
1 parent efbe292 commit 3b987f8

File tree

15 files changed

+50
-28
lines changed

15 files changed

+50
-28
lines changed

.github/workflows/build-and-push.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
infrastructure-images:
7272
needs: base-images
7373
if: github.repository == 'geoserver/geoserver-cloud'
74-
name: Build and Push Infrastructure Images
74+
name: Build infrastructure images
7575
runs-on: ubuntu-latest
7676
timeout-minutes: 60
7777
steps:
@@ -118,9 +118,14 @@ jobs:
118118
geoserver-images:
119119
needs: base-images
120120
if: github.repository == 'geoserver/geoserver-cloud'
121-
name: Build and Push GeoServer Images
121+
name: Build GeoServer image
122122
runs-on: ubuntu-latest
123123
timeout-minutes: 60
124+
strategy:
125+
fail-fast: false
126+
matrix:
127+
# matches app folder names in src/apps/geoserver/* and docker compose service names
128+
app: [ 'wms', 'wfs', 'wcs', 'wps', 'gwc', 'restconfig', 'webui' ]
124129
steps:
125130
- name: Login to Docker Hub
126131
uses: docker/login-action@v3
@@ -151,11 +156,11 @@ jobs:
151156

152157
- name: Package GeoServer apps
153158
run: |
154-
make package-geoserver-images
159+
./mvnw clean package -DskipTests -T1C -nsu -am -pl src/apps/geoserver/${{ matrix.app }}
155160
156161
- name: Build and push GeoServer images
157162
run: |
158-
make build-image-geoserver-multiplatform
163+
make build-image-geoserver-multiplatform ${{ matrix.app }}
159164
160165
- name: Clean up Maven project artifacts
161166
run: |
@@ -188,10 +193,7 @@ jobs:
188193

189194
- name: Pull all images
190195
run: |
191-
TAG=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
192-
for image in config discovery gateway gwc rest wcs webui wfs wms wps; do
193-
docker pull geoservercloud/geoserver-cloud-$image:$TAG
194-
done
196+
make pull-images
195197
196198
- name: Install Cosign
197199
uses: sigstore/cosign-installer@v3.5.0

Makefile

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ build-image-infrastructure: package-infrastructure-images
7171
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
7272
docker compose -f docker-build/infrastructure.yml build
7373

74+
# 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).
75+
# Then you can call:
76+
# make build-image-geoserver wcs wfs
7477
.PHONY: build-image-geoserver
7578
build-image-geoserver: package-geoserver-images
7679
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
77-
docker compose -f docker-build/geoserver.yml build
80+
docker compose -f docker-build/geoserver.yml build $(filter-out $@ build-image build-image-multiplatform,$(MAKECMDGOALS))
7881

7982
.PHONY: build-image-multiplatform
8083
build-image-multiplatform: build-base-images-multiplatform build-image-infrastructure-multiplatform build-image-geoserver-multiplatform
@@ -97,10 +100,13 @@ build-image-infrastructure-multiplatform: package-infrastructure-images
97100
TAG=$(TAG) \
98101
docker compose -f docker-build/infrastructure-multiplatform.yml build --push
99102

103+
# 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).
104+
# Then you can call:
105+
# make build-image-geoserver-multiplatform wcs wfs
100106
.PHONY: build-image-geoserver-multiplatform
101107
build-image-geoserver-multiplatform: package-geoserver-images
102108
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 TAG=$(TAG) \
103-
docker compose -f docker-build/geoserver-multiplatform.yml build --push
109+
docker compose -f docker-build/geoserver-multiplatform.yml build --push $(filter-out $@ build-image build-image-multiplatform,$(MAKECMDGOALS))
104110

105111
.PHONY: package-base-images
106112
package-base-images:
@@ -126,10 +132,19 @@ else
126132
@echo "Not re-packaging geoserver images, assuming the target/*-bin.jar files exist"
127133
endif
128134

135+
.PHONY: pull-images
136+
pull-images:
137+
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) \
138+
docker compose \
139+
-f docker-build/geoserver-multiplatform.yml \
140+
-f docker-build/infrastructure-multiplatform.yml \
141+
pull --quiet
142+
129143
.PHONY: sign-image
130144
sign-image:
131145
@bash -c '\
132-
images=$$(docker images --format "{{.Repository}}@{{.Digest}}" | grep "geoserver-cloud-"); \
146+
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout); \
147+
images=$$(TAG=$$TAG docker compose -f docker-build/geoserver-multiplatform.yml -f docker-build/infrastructure-multiplatform.yml config --images); \
133148
for image in $$images; do \
134149
echo "Signing $$image"; \
135150
output=$$(cosign sign --yes --key env://COSIGN_KEY --recursive $$image 2>&1); \
@@ -144,7 +159,8 @@ sign-image:
144159
.PHONY: verify-image
145160
verify-image:
146161
@bash -c '\
147-
images=$$(docker images --format "{{.Repository}}@{{.Digest}}" | grep "geoserver-cloud-"); \
162+
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout); \
163+
images=$$(TAG=$$TAG docker compose -f docker-build/geoserver-multiplatform.yml -f docker-build/infrastructure-multiplatform.yml config --images); \
148164
for image in $$images; do \
149165
echo "Verifying $$image"; \
150166
output=$$(cosign verify --key env://COSIGN_PUB_KEY $$image 2>&1); \
@@ -204,3 +220,7 @@ run-acceptance-tests-jdbcconfig:
204220
.PHONY: clean-acceptance-tests-jdbcconfig
205221
clean-acceptance-tests-jdbcconfig:
206222
(cd compose/ && ./acceptance_jdbcconfig down -v)
223+
224+
# Prevent make from treating service names as targets when using $(MAKECMDGOALS) in build-image-geoserver/build-image-geoserver-multiplatform
225+
%:
226+
@:

compose/acceptance.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
condition: service_healthy
2020
gwc:
2121
condition: service_healthy
22-
rest:
22+
restconfig:
2323
condition: service_healthy
2424
#webui:
2525
# condition: service_started
@@ -89,7 +89,7 @@ services:
8989
memory: 512M
9090
healthcheck:
9191
retries: 20
92-
rest:
92+
restconfig:
9393
deploy:
9494
resources:
9595
limits:

compose/catalog-datadir.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ services:
5353
volumes: *geoserver_volumes
5454
depends_on: *gs-dependencies
5555

56-
rest:
56+
restconfig:
5757
environment: *geoserver_environment
5858
volumes: *geoserver_volumes
5959
depends_on: *gs-dependencies

compose/catalog-jdbcconfig.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ services:
5454
volumes: *geoserver_volumes
5555
depends_on: *gs-dependencies
5656

57-
rest:
57+
restconfig:
5858
environment: *geoserver_environment
5959
volumes: *geoserver_volumes
6060
depends_on: *gs-dependencies

compose/catalog-pgconfig.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
environment: *geoserver_environment
2525
depends_on: *gs-dependencies
2626

27-
rest:
27+
restconfig:
2828
environment: *geoserver_environment
2929
depends_on: *gs-dependencies
3030

compose/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ services:
164164
cpus: '4.0'
165165
memory: 2G
166166

167-
rest:
167+
restconfig:
168168
extends:
169169
file: templates.yml
170170
service: gstemplate

compose/localports.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
wcs:
2121
ports:
2222
- 9103:8080
23-
rest:
23+
restconfig:
2424
ports:
2525
- 9105:8080
2626
webui:

compose/standalone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ services:
8080
condition: service_healthy
8181
required: true
8282

83-
rest:
83+
restconfig:
8484
environment:
8585
SPRING_PROFILES_INCLUDE: "standalone"
8686
depends_on:

config

0 commit comments

Comments
 (0)