From 1867c8fa000d03dc5485875feb97bf5584504519 Mon Sep 17 00:00:00 2001
From: Mark Prins <1165786+mprins@users.noreply.github.com>
Date: Mon, 16 Jan 2023 11:23:35 +0100
Subject: [PATCH] Bouw en publiceer de docker images voor de brmo-service stack
---
.github/workflows/linux.yml | 43 +++++++++++++--
bag2-loader/Dockerfile | 2 +-
bgt-loader/Dockerfile | 2 +-
docker/README.md | 10 ++--
docker/docker-compose.yml | 7 +--
docker/pom.xml | 89 +++++++++++++++++++++++++------
docker/src/main/docker/Dockerfile | 10 +++-
pom.xml | 4 +-
8 files changed, 129 insertions(+), 38 deletions(-)
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index b5a998202c..f53e7f97e2 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -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
@@ -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:
@@ -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() }}
diff --git a/bag2-loader/Dockerfile b/bag2-loader/Dockerfile
index 10e996379f..1411c2e742 100644
--- a/bag2-loader/Dockerfile
+++ b/bag2-loader/Dockerfile
@@ -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"
diff --git a/bgt-loader/Dockerfile b/bgt-loader/Dockerfile
index d74d28cd69..5e0cee23e2 100644
--- a/bgt-loader/Dockerfile
+++ b/bgt-loader/Dockerfile
@@ -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"
diff --git a/docker/README.md b/docker/README.md
index c74aaadb1f..e122499c69 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -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
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 69f24666c6..a6105a808d 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -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
@@ -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
diff --git a/docker/pom.xml b/docker/pom.xml
index b8cb3009c0..cef77d8659 100644
--- a/docker/pom.xml
+++ b/docker/pom.xml
@@ -66,18 +66,28 @@
+
+ ghcr.io/b3partners/brmo-service-db:snapshot
+
+ .
+ pg_conf/Dockerfile
+
+ ${project.version}
+
+
+
- docker-build
+ default-build
build
package
- docker-push
+ default-push
push
@@ -112,12 +122,28 @@
ghcr.io/b3partners/brmo-service:%l
+
+ Dockerfile
+
+ ${project.version}
+
+
+
+
+ ghcr.io/b3partners/brmo-service-db:%l
+
+ .
+ pg_conf/Dockerfile
+
+ ${project.version}
+
+
- docker-tag
+ tag-latest
tag
@@ -128,7 +154,7 @@
- docker-push-latest
+ push-latest
push
@@ -139,6 +165,9 @@
ghcr.io/b3partners/brmo-service:latest
+
+ ghcr.io/b3partners/brmo-service-db:latest
+
@@ -154,19 +183,45 @@
Windows
-
-
-
-
- io.fabric8
- docker-maven-plugin
-
- false
- true
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+ macos
+
+
+ mac
+
+
+
+ true
+
+
+
+ openbsd
+
+
+ openbsd
+ unix
+
+
+
+ true
+
diff --git a/docker/src/main/docker/Dockerfile b/docker/src/main/docker/Dockerfile
index 95557c6a05..431f5919e8 100644
--- a/docker/src/main/docker/Dockerfile
+++ b/docker/src/main/docker/Dockerfile
@@ -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"
@@ -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 \
@@ -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"]
diff --git a/pom.xml b/pom.xml
index e841ebe5c1..bf76ee63b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1182,13 +1182,13 @@
${skipQA}
false
- false
+ true
false
stop
strict
false
4
- true
+ false