Merge pull request #407 from groldan/build/use_docker_compose_build_to_create_images

Use `docker compose build` to create the images.
This commit is contained in:
Gabriel Roldan 2023-12-30 21:58:42 -03:00 committed by GitHub
commit 8f11852e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 160 additions and 446 deletions

View File

@ -44,9 +44,13 @@ jobs:
run: |
make install
- name: Build and push Hotspot docker images
- name: Build images
run: |
make build-image SKIP_PUSH=false
make build-image
- name: Push images
run: |
make push-image
- name: Remove project jars from cached repository
run: |

View File

@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v2
with:

View File

@ -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
@ -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
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
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
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

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -8,10 +8,6 @@
</parent>
<artifactId>gs-cloud-base-geoserver-image</artifactId>
<packaging>jar</packaging>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>${project.artifactId}</docker.image.name>
</properties>
<dependencies>
<dependency>
<groupId>org.geoserver.cloud</groupId>
@ -60,35 +56,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
<executions>
<execution>
<id>push</id>
<configuration>
<!-- always skip push -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -9,11 +9,6 @@
<artifactId>gs-cloud-base-jre</artifactId>
<packaging>jar</packaging>
<name>Base JRE image</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>${project.artifactId}</docker.image.name>
</properties>
<dependencies></dependencies>
<build>
<plugins>
<plugin>
@ -26,32 +21,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<executions>
<execution>
<id>push</id>
<configuration>
<!-- always skip push -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -8,10 +8,6 @@
</parent>
<artifactId>gs-cloud-base-spring-boot</artifactId>
<packaging>jar</packaging>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>${project.artifactId}</docker.image.name>
</properties>
<dependencies>
<dependency>
<groupId>org.geoserver.cloud</groupId>
@ -50,39 +46,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<tag>${project.version}</tag>
<pullNewerImage>false</pullNewerImage>
<buildArgs>
<TAG>${project.version}</TAG>
</buildArgs>
</configuration>
<executions>
<execution>
<id>push</id>
<configuration>
<!-- always skip push -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>gwc-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-gwc</docker.image.name>
<start-class>org.geoserver.cloud.gwc.app.GeoWebCacheApplication</start-class>
</properties>
<dependencies>
@ -91,26 +89,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -29,13 +29,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-webmvc-common-docker-layers</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>restconfig-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-rest</docker.image.name>
<start-class>org.geoserver.cloud.restconfig.RestConfigApplication</start-class>
</properties>
<dependencies>
@ -75,26 +73,6 @@
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>importer</id>
<activation>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>wcs-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-wcs</docker.image.name>
<start-class>org.geoserver.cloud.wcs.WcsApplication</start-class>
</properties>
<dependencies>
@ -62,26 +60,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>web-ui-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-webui</docker.image.name>
<start-class>org.geoserver.cloud.web.app.WebUIApplication</start-class>
</properties>
<dependencies>
@ -173,26 +171,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>wfs-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-wfs</docker.image.name>
<start-class>org.geoserver.cloud.wfs.WfsApplication</start-class>
</properties>
<dependencies>
@ -87,26 +85,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>wms-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-wms</docker.image.name>
<start-class>org.geoserver.cloud.wms.app.WmsApplication</start-class>
</properties>
<dependencies>
@ -84,26 +82,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>wps-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-wps</docker.image.name>
<start-class>org.geoserver.cloud.wps.WpsApplication</start-class>
</properties>
<dependencies>
@ -63,23 +61,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>Spring-boot admin service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-admin-server</docker.image.name>
<start-class>org.geoserver.cloud.adminserver.SpringBootAdminServerApplication</start-class>
</properties>
<dependencies>
@ -53,26 +51,4 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>Cloud config service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-config</docker.image.name>
<spring-boot.build-image.imageName>geoservercloud/geoserver-cloud-config:${project.version}</spring-boot.build-image.imageName>
<start-class>org.geoserver.cloud.config.ConfigApplication</start-class>
</properties>
@ -132,42 +130,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>bin</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -10,8 +10,6 @@
<packaging>jar</packaging>
<name>Discovery service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-discovery</docker.image.name>
<start-class>org.geoserver.cloud.discovery.DiscoveryApplication</start-class>
</properties>
<dependencies>
@ -59,26 +57,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -9,10 +9,6 @@
<artifactId>gs-cloud-gateway</artifactId>
<packaging>jar</packaging>
<name>API gateway service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-gateway</docker.image.name>
</properties>
<dependencies>
<dependency>
<groupId>org.geoserver.cloud</groupId>
@ -81,26 +77,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<pullNewerImage>false</pullNewerImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -36,16 +36,6 @@
<testcontainers.version>1.19.1</testcontainers.version>
<fork.javac>true</fork.javac>
<javac.maxHeapSize>256M</javac.maxHeapSize>
<!-- docker.image.prefix: dockerhub organization name -->
<docker.image.prefix>geoservercloud</docker.image.prefix>
<!-- Set docker.image.name on each service pom -->
<docker.image.name>change_me</docker.image.name>
<docker.image.repository>${docker.image.prefix}/${docker.image.name}</docker.image.repository>
<!-- set dockerfile.skip to false in service projects to we can run mvn
dockerfile:build from the root directory -->
<dockerfile.skip>true</dockerfile.skip>
<dockerfile.build.pullNewerImage>false</dockerfile.build.pullNewerImage>
<dockerfile.push.skip>true</dockerfile.push.skip>
<!--
aws.version overrides the old version provided by gs-cog->imageio-ext-cog
(2.9.24), which
@ -825,38 +815,6 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<inherited>true</inherited>
<configuration>
<repository>${docker.image.repository}</repository>
<tag>${project.version}</tag>
<buildArgs>
<TAG>${project.version}</TAG>
<JAR_FILE>target/${project.build.finalName}-bin.jar</JAR_FILE>
</buildArgs>
</configuration>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push</id>
<goals>
<goal>push</goal>
</goals>
<phase>package</phase>
<configuration>
<skip>${dockerfile.push.skip}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>