Skip to content

Commit

Permalink
Bouw en publiceer de docker images voor de brmo-service stack
Browse files Browse the repository at this point in the history
  • Loading branch information
mprins committed Jan 16, 2023
1 parent 27aa91a commit 1867c8f
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 38 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:

jobs:
build:
name: Java ${{ matrix.java }} / PostGIS ${{ matrix.postgis }}
name: "Java ${{ matrix.java }} / PostGIS ${{ matrix.postgis }}"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand All @@ -28,10 +28,10 @@ jobs:
# zie ook https://www.postgresql.org/support/versioning/
postgis:
# tot 11-2023
- 11-3.3-alpine
- 12-3.3-alpine
- 13-3.3-alpine
- 14-3.3-alpine
# - 11-3.3-alpine
# - 12-3.3-alpine
# - 13-3.3-alpine
# - 14-3.3-alpine
- 15-3.3-alpine

steps:
Expand Down Expand Up @@ -180,6 +180,39 @@ jobs:
run: mvn -B -V -fae -DskipQA=false -Dfmt.action=check -Dpom.fmt.action=verify -Ddocker.skip=true -Dtest.onlyITs= -Dmaven.test.skip=true clean package


deploy:
name: 'Deploy docker images'
# if: ${{ github.repository == 'B3Partners/brmo' && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
# needs: [build, qacheck]
runs-on: ubuntu-22.04
# permissions:
# contents: read
# packages: write
steps:
- uses: actions/checkout@v3
with:
lfs: false

- name: 'Set up JDK'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
cache: 'maven'
# server-id: 'ghcr.io'
# server-username: GITHUB_ACTOR
# server-password: GITHUB_TOKEN

- name: 'Build and Push docker images'
env:
GITHUB_TOKEN: ${{ github.token }}
# GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn clean install -Dmaven.test.skip=true -Ddocker.skip=false -Dtest.onlyITs= -B -V -fae -DskipQA=true
mvn deploy -pl :docker -DskipQA=true -Ddocker.skip=false
cleanup:
name: 'Maven cache cleanup'
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion bag2-loader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM eclipse-temurin:11.0.17_8-jre

LABEL org.opencontainers.image.source=https://github.com/b3partners/brmo/bag2-loader

ARG BRMO_VERSION=2.3.3-SNAPSHOT
ARG BRMO_VERSION=3.0.0-SNAPSHOT
ARG DEBIAN_FRONTEND="noninteractive"
ARG TZ="Europe/Amsterdam"

Expand Down
2 changes: 1 addition & 1 deletion bgt-loader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM eclipse-temurin:11.0.17_8-jre

LABEL org.opencontainers.image.source=https://github.com/b3partners/brmo/bgt-citygml-loader

ARG BRMO_VERSION=2.3.3-SNAPSHOT
ARG BRMO_VERSION=3.0.0-SNAPSHOT
ARG DEBIAN_FRONTEND="noninteractive"
ARG TZ="Europe/Amsterdam"

Expand Down
10 changes: 5 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ mvn clean deploy
Start een stack met de bijvoorbeeld volgende command line:

```shell
docker compose --env-file /home/mark/dev/projects/brmo/docker/localhost.env \
-f /home/mark/dev/projects/brmo/docker/docker-compose.yml \
-f /home/mark/dev/projects/brmo/docker/docker-compose-ports.yml \
-p brmo-service up --always-recreate-deps --remove-orphans -d --build
docker compose --env-file docker/localhost.env \
-f docker/docker-compose.yml \
-f docker/docker-compose-ports.yml \
-p brmo-service up --always-recreate-deps --remove-orphans -d
```

Het default password dient te worden aangepast voordat er data wordt geladen.
Het default password van de brmo-service dient te worden aangepast voordat er data wordt geladen.
Gebruik de procedure op https://github.com/B3Partners/brmo/wiki/update-wachtwoord-procedure#versies-vanaf-210

```shell
Expand Down
7 changes: 1 addition & 6 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ volumes:

services:
db:
build:
context: ./src/main/docker
dockerfile: pg_conf/Dockerfile
image: ghcr.io/b3partners/brmo-service-db:${BRMO_VERSION:-snapshot}
shm_size: '2gb'
command: >
-c shared_buffers=8GB
Expand All @@ -31,9 +29,6 @@ services:

brmo:
image: ghcr.io/b3partners/brmo-service:${BRMO_VERSION:-snapshot}
build:
context: ./src/main/docker
dockerfile: Dockerfile
shm_size: '512mb'
volumes:
- brmo-logs:/usr/local/tomcat/logs
Expand Down
89 changes: 72 additions & 17 deletions docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,28 @@
</args>
</build>
</image>
<image>
<name>ghcr.io/b3partners/brmo-service-db:snapshot</name>
<build>
<contextDir>.</contextDir>
<dockerFile>pg_conf/Dockerfile</dockerFile>
<args>
<BRMO_VERSION>${project.version}</BRMO_VERSION>
</args>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-build</id>
<id>default-build</id>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>docker-push</id>
<id>default-push</id>
<goals>
<goal>push</goal>
</goals>
Expand Down Expand Up @@ -112,12 +122,28 @@
<images>
<image>
<name>ghcr.io/b3partners/brmo-service:%l</name>
<build>
<dockerFile>Dockerfile</dockerFile>
<args>
<BRMO_VERSION>${project.version}</BRMO_VERSION>
</args>
</build>
</image>
<image>
<name>ghcr.io/b3partners/brmo-service-db:%l</name>
<build>
<contextDir>.</contextDir>
<dockerFile>pg_conf/Dockerfile</dockerFile>
<args>
<BRMO_VERSION>${project.version}</BRMO_VERSION>
</args>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-tag</id>
<id>tag-latest</id>
<goals>
<goal>tag</goal>
</goals>
Expand All @@ -128,7 +154,7 @@
</configuration>
</execution>
<execution>
<id>docker-push-latest</id>
<id>push-latest</id>
<goals>
<goal>push</goal>
</goals>
Expand All @@ -139,6 +165,9 @@
<image>
<name>ghcr.io/b3partners/brmo-service:latest</name>
</image>
<image>
<name>ghcr.io/b3partners/brmo-service-db:latest</name>
</image>
</images>
</configuration>
</execution>
Expand All @@ -154,19 +183,45 @@
<family>Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<!-- skip op Windows -->
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<verbose>false</verbose>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- &lt;!&ndash; skip op Windows &ndash;&gt;-->
<!-- <groupId>io.fabric8</groupId>-->
<!-- <artifactId>docker-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <verbose>false</verbose>-->
<!-- <skip>true</skip>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
<properties>
<docker.skip>true</docker.skip>
</properties>
</profile>
<profile>
<id>macos</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<docker.skip>true</docker.skip>
</properties>
</profile>
<profile>
<id>openbsd</id>
<activation>
<os>
<name>openbsd</name>
<family>unix</family>
</os>
</activation>
<properties>
<docker.skip>true</docker.skip>
</properties>
</profile>
</profiles>
</project>
10 changes: 9 additions & 1 deletion docker/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tomcat:9.0.70-jre11-temurin
FROM tomcat:9.0.71-jre11-temurin

ARG TZ="Europe/Amsterdam"
ARG DEBIAN_FRONTEND="noninteractive"
Expand Down Expand Up @@ -31,6 +31,10 @@ RUN set -eux;ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/t
&& mkdir -p /opt/brmo-data/TOPNL/Top100NL/ \
&& mkdir -p /opt/brmo-data/TOPNL/Top250NL/ \
&& mkdir -p /opt/brmo-data/sqlscripts/ \
&& chown -R www-data:www-data /usr/local/tomcat/webapps \
&& chown -R www-data:www-data /usr/local/tomcat/logs \
# && chown -R www-data:www-data /usr/local/tomcat/conf/Catalina/localhost \
&& chown -R www-data:www-data /opt/brmo-data \
&& apt-get update \
&& apt-get install -y --no-install-recommends postgresql-client less \
&& apt-get -y --purge autoremove \
Expand All @@ -54,6 +58,10 @@ COPY tomcat_conf /usr/local/tomcat/conf/

EXPOSE 8080

WORKDIR /usr/local/tomcat

USER www-data:www-data

HEALTHCHECK --interval=25s --timeout=5s --retries=2 CMD curl -f http://localhost:8080/brmo-service/ || exit 1

VOLUME ["/usr/local/tomcat/logs", "/opt/brmo-data"]
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1182,13 +1182,13 @@
<configuration>
<skip>${skipQA}</skip>
<keepBlankLines>false</keepBlankLines>
<spaceBeforeCloseEmptyElement>false</spaceBeforeCloseEmptyElement>
<spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
<createBackupFile>false</createBackupFile>
<verifyFail>stop</verifyFail>
<verifyFailOn>strict</verifyFailOn>
<expandEmptyElements>false</expandEmptyElements>
<nrOfIndentSpace>4</nrOfIndentSpace>
<indentSchemaLocation>true</indentSchemaLocation>
<indentSchemaLocation>false</indentSchemaLocation>
</configuration>
<executions>
<execution>
Expand Down

0 comments on commit 1867c8f

Please sign in to comment.