view 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 source
# Docker file for D4E River artifact server

FROM centos:7
MAINTAINER tom@intevation.de

# Necessary to run further yum-installs inside Docker container,
# if not already part of the base image:
RUN yum -y install yum-plugin-ovl && rpm --rebuilddb

# Install prerequisites
RUN yum -y install maven mercurial curl

# Add DEMs from demo dataset
ENV DEM_DIR /opt/d4e-river/dgm
ENV DATA_ARCH demodaten_3.1.10-bis-3.2.x.tar.gz
RUN mkdir -p $DEM_DIR
RUN curl -s "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
    tar -C $DEM_DIR --strip-components=1 --wildcards -xz 'demodaten/dem*.grd'


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
RUN hg clone -b $BRANCH $REPO_URL/http-client

RUN mvn -q -f framework/pom.xml install
RUN mvn -q -f http-client/pom.xml install

ADD . river

RUN mvn -q -f river/backend/pom.xml install

WORKDIR river/artifacts

# Install WSPLGEN
ENV WSPLGEN_URL https://wald.intevation.org/frs/download.php/1496/wsplgen-linux-64bit-static.gz
RUN curl -s $WSPLGEN_URL | gunzip > bin/wsplgen && chmod +x bin/wsplgen

# Create h2 databases
RUN ../../framework/artifact-database/bin/createArtifacts.sh
RUN ./bin/createDatacage.sh

RUN mvn -q package assembly:single

EXPOSE 8181

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

http://dive4elements.wald.intevation.org