Mercurial > dive4elements > river
diff docker/Dockerfile.artifacts @ 9731:1dfcbb09c231 3.2.x
Improve server deployment in Docker container
_ Compile during build instead of with CMD
_ No longer run service as root user
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 15 Jul 2022 16:24:56 +0200 |
parents | 0a5239a1e46e |
children | a6c6bba0fc4b |
line wrap: on
line diff
--- a/docker/Dockerfile.artifacts Tue Jul 12 16:34:28 2022 +0200 +++ b/docker/Dockerfile.artifacts Fri Jul 15 16:24:56 2022 +0200 @@ -18,7 +18,7 @@ tar -C $DEM_DIR --strip-components=1 --wildcards -xz 'demodaten/dem*.grd' -WORKDIR /opt/d4e +WORKDIR /opt/d4e/src ENV REPO_URL https://scm.wald.intevation.org/hg/dive4elements/ ENV BRANCH 3.2.x RUN hg clone -b $BRANCH $REPO_URL/framework @@ -38,15 +38,18 @@ RUN curl -s $WSPLGEN_URL | gunzip > bin/wsplgen && chmod +x bin/wsplgen # Create h2 databases -RUN ../../framework/artifact-database/bin/createArtifacts.sh && \ - mv artifactsdb doc/ -RUN ./bin/createDatacage.sh && \ - mv datacagedb doc/ +RUN ../../framework/artifact-database/bin/createArtifacts.sh +RUN ./bin/createDatacage.sh + +RUN mvn -q package assembly:single EXPOSE 8181 -CMD mvn -Dexec.mainClass=org.dive4elements.artifactdatabase.App \ - -Dlog4j2.configurationFile="file:///opt/d4e/river/artifacts/doc/conf/log4j2.xml" \ - -Dartifact.database.dir="/opt/d4e/river/artifacts/doc/conf" \ - -Dwsplgen.bin.path="/opt/d4e/river/artifacts/bin/wsplgen" \ - compile exec:java +WORKDIR /opt/d4e/bin +RUN useradd d4e +RUN chown d4e:d4e . +USER d4e + +RUN tar -xf ../src/river/artifacts/target/river-artifacts-1.0-SNAPSHOT-bin.tar + +CMD bin/run.sh