Skip to content

Commit

Permalink
Use docker compose build to create the images
Browse files Browse the repository at this point in the history
  • Loading branch information
groldan committed Dec 29, 2023
1 parent c8bc557 commit 26fe838
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ jobs:

- name: Build images
run: |
make build-image SKIP_PUSH=false
#make build-image
make build-image
# - name: Push images
# run: |
# make push-image

- name: Remove project jars from cached repository
run: |
Expand Down
35 changes: 24 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
all: install test build-image

# run `make build-image[-*] SKIP_PUSH=false` to push the images to dockerhub
SKIP_PUSH?="true"
TAG=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`

lint:
./mvnw fmt:check sortpom:verify -Dsort.verifyFailOn=strict -Dsort.verifyFail=stop -ntp
Expand All @@ -15,19 +14,33 @@ install:
test:
./mvnw verify -ntp -T4

build-image: build-base-images build-image-infrastructure build-image-geoserver

build-image-openj9: build-image-infrastructure-openj9 build-image-geoserver-openj9

build-base-images:
./mvnw clean package -f src/apps/base-images \
-Ddocker -Ddockerfile.push.skip=true -ntp -Dfmt.skip -DskipTests
./mvnw clean package -f src/apps/base-images -DksipTests -T4 && \
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
TAG=$(TAG) \
docker compose -f docker-build/base-images.yml build --push

build-image-infrastructure:
./mvnw clean package -f src/apps/infrastructure \
-Ddocker -Ddockerfile.push.skip=$(SKIP_PUSH) -ntp -Dfmt.skip -DskipTests
./mvnw clean package -f src/apps/infrastructure -DskipTests -T4 && \
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
TAG=$(TAG) \
docker compose -f docker-build/infrastructure.yml build --push

build-image-geoserver:
./mvnw clean package -f src/apps/geoserver \
-Ddocker -Ddockerfile.push.skip=$(SKIP_PUSH) -ntp -Dfmt.skip -DskipTests
./mvnw clean package -f src/apps/geoserver -DskipTests -T4 && \
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
TAG=$(TAG) \
docker compose -f docker-build/geoserver.yml build --push

build-image: build-base-images build-image-infrastructure build-image-geoserver

push-image:
TAG=$(TAG) \
docker compose \
-f docker-build/infrastructure.yml \
-f docker-build/geoserver.yml \
push
29 changes: 29 additions & 0 deletions docker-build/base-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3.8"

services:
base-image-jre:
image: geoservercloud/gs-cloud-base-jre:${TAG}
build:
no_cache: true
pull: true
context: ../src/apps/base-images/jre/

base-image-spring-boot:
image: geoservercloud/gs-cloud-base-spring-boot:${TAG}
depends_on: [base-image-jre]
build:
no_cache: true
pull: false
context: ../src/apps/base-images/spring-boot/
args:
TAG: ${TAG}

base-image-geoserver:
image: geoservercloud/gs-cloud-base-geoserver-image:${TAG}
depends_on: [base-image-spring-boot]
build:
no_cache: true
pull: false
context: ../src/apps/base-images/geoserver/
args:
TAG: ${TAG}
66 changes: 66 additions & 0 deletions docker-build/geoserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: "3.8"

services:
wfs:
image: geoservercloud/geoserver-cloud-wfs:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/wfs/
args:
TAG: ${TAG}

wms:
image: geoservercloud/geoserver-cloud-wms:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/wms/
args:
TAG: ${TAG}

wcs:
image: geoservercloud/geoserver-cloud-wcs:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/wcs/
args:
TAG: ${TAG}

wps:
image: geoservercloud/geoserver-cloud-wps:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/wps/
args:
TAG: ${TAG}

rest:
image: geoservercloud/geoserver-cloud-rest:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/restconfig/
args:
TAG: ${TAG}

webui:
image: geoservercloud/geoserver-cloud-webui:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/webui/
args:
TAG: ${TAG}

gwc:
image: geoservercloud/geoserver-cloud-gwc:${TAG}
build:
no_cache: true
pull: false
context: ../src/apps/geoserver/gwc/
args:
TAG: ${TAG}

34 changes: 34 additions & 0 deletions docker-build/infrastructure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.8"

services:
discovery:
image: geoservercloud/geoserver-cloud-discovery:${TAG}
build:
no_cache: true
context: ../src/apps/infrastructure/discovery/
args:
TAG: ${TAG}

config:
image: geoservercloud/geoserver-cloud-config:${TAG}
build:
no_cache: true
context: ../src/apps/infrastructure/config/
args:
TAG: ${TAG}

admin:
image: geoservercloud/geoserver-cloud-admin-server:${TAG}
build:
no_cache: true
context: ../src/apps/infrastructure/admin/
args:
TAG: ${TAG}

gateway:
image: geoservercloud/geoserver-cloud-gateway:${TAG}
build:
no_cache: true
context: ../src/apps/infrastructure/gateway/
args:
TAG: ${TAG}

0 comments on commit 26fe838

Please sign in to comment.