From d78658a8367479aed5b0d982d1a8caa3e5fd9628 Mon Sep 17 00:00:00 2001 From: christophe mangeat Date: Sat, 19 Jun 2021 23:55:54 +0200 Subject: [PATCH] vanilla 4.4.6 h2 (SNAPSHOT) container for dev node --- .github/workflows/geocat-docker.yml | 57 +++++++++++ web/pom.xml | 45 +++++++++ web/src/docker/Dockerfile | 16 ++++ web/src/docker/docker-entrypoint.sh | 11 +++ web/src/docker/enable_gzip.augtool | 7 ++ web/src/docker/server.xml | 141 ++++++++++++++++++++++++++++ 6 files changed, 277 insertions(+) create mode 100644 .github/workflows/geocat-docker.yml create mode 100644 web/src/docker/Dockerfile create mode 100755 web/src/docker/docker-entrypoint.sh create mode 100644 web/src/docker/enable_gzip.augtool create mode 100644 web/src/docker/server.xml diff --git a/.github/workflows/geocat-docker.yml b/.github/workflows/geocat-docker.yml new file mode 100644 index 00000000000..c12521fd081 --- /dev/null +++ b/.github/workflows/geocat-docker.yml @@ -0,0 +1,57 @@ +name: geocat-docker + +on: + push: + branches: + - geocat_4.4.6_vanilla + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + + - name: "Checking out" + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: "Setup Java JDK" + uses: actions/setup-java@v4.2.1 + with: + java-version: 11 + distribution: temurin + java-package: jdk + cache: maven + + - name: "Cache Maven packages" + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: "Update maven dependencies" + run: mvn -Pdocker de.qaware.maven:go-offline-maven-plugin:resolve-dependencies + + - name: "Increase system limits" + run: sudo sysctl -w vm.max_map_count=262144 + + - name: "Run tests" + run: | + mvn clean verify -Pit + - name: "Installing" + run: mvn -B clean -DskipTests -Des.host=es -Ddb.type=h2 -D install + + - name: "Setting image tag" + id: version + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: "Building docker image" + run: mvn -pl web -Pdocker docker:build -DdockerImageName=docker.pkg.github.com/geoadmin/geocat/geocat:${{ steps.version.outputs.VERSION }}-${{ github.run_number }} + + - name: "Login to docker.pkg.github.com" + run: docker login -u $GITHUB_ACTOR -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com + + - name: "Push to GitHub Packages" + run: docker push docker.pkg.github.com/geoadmin/geocat/geocat:${{ steps.version.outputs.VERSION }}-${{ github.run_number }} diff --git a/web/pom.xml b/web/pom.xml index 960e20c0772..54d37301b86 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -1392,6 +1392,51 @@ + + + docker + + camptocamp/geocat:latest + + + + + com.spotify + docker-maven-plugin + 0.4.14 + + ${dockerImageName} + web/src/docker + + + /usr/local/tomcat/webapps + ${project.build.directory} + geonetwork.war + + + /usr/local/bin/ + ${project.basedir}/../ + s3sync-geocat-folders.sh + + + / + ${project.basedir}/src/docker/ + docker-entrypoint.sh + + + / + ${project.basedir}/src/docker/ + docker-entrypoint.d + + + + docker-hub + https://index.docker.io/v1/ + + + + + diff --git a/web/src/docker/Dockerfile b/web/src/docker/Dockerfile new file mode 100644 index 00000000000..07cc126ab83 --- /dev/null +++ b/web/src/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM tomcat:8.5.85-jre8 + +ADD ./server.xml /usr/local/tomcat/conf/ + +ADD . / + +LABEL "io.upkick.warn_only"="true" + +# Enable Gzip compression on tomcat +RUN cat /enable_gzip.augtool | augtool --noload --noautoload --echo + +RUN cd /usr/local/tomcat/webapps && \ + unzip -d geonetwork geonetwork.war && \ + rm geonetwork.war + +ENTRYPOINT ["/docker-entrypoint.sh", "catalina.sh", "run"] diff --git a/web/src/docker/docker-entrypoint.sh b/web/src/docker/docker-entrypoint.sh new file mode 100755 index 00000000000..87638681efb --- /dev/null +++ b/web/src/docker/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +DIR=/docker-entrypoint.d + +if [[ -d "$DIR" ]] +then + /bin/run-parts --verbose "$DIR" +fi + +exec "$@" + diff --git a/web/src/docker/enable_gzip.augtool b/web/src/docker/enable_gzip.augtool new file mode 100644 index 00000000000..841e2046cdd --- /dev/null +++ b/web/src/docker/enable_gzip.augtool @@ -0,0 +1,7 @@ +set /augeas/load/xml/lens "Xml.lns" +set /augeas/load/xml/incl "/usr/local/tomcat/conf/server.xml" +load +set /files/usr/local/tomcat/conf/server.xml/Server/Service/Connector[#attribute/port = '8080']/#attribute/compression 'on' +set /files/usr/local/tomcat/conf/server.xml/Server/Service/Connector[#attribute/port = '8080']/#attribute/compressibleMimeType 'text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json' +save + diff --git a/web/src/docker/server.xml b/web/src/docker/server.xml new file mode 100644 index 00000000000..b42c2ec58f4 --- /dev/null +++ b/web/src/docker/server.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +