add env variable to set encoding
[cdm-server.git] / src / main / docker / production / Dockerfile
1 FROM ubuntu:bionic
2 # using same image as for https://github.com/mariadb-corporation/mariadb-server-docker/blob/master/10.3/Dockerfile
3
4 # paths of files and directories will be interpreted as relative to the source of the context of the build.
5
6 ### ADD directive for the maven docker plugin
7 # 1. The maven plugin copies the jar to the artifacts assembly locaton at:
8 # ./target/docker/eu.etaxonomy/cdm-server/${project.version}/build/maven/cdm-server-${project.version}.jar
9 # 2. a tar is being created at target/docker/eu.etaxonomy/cdm-server/${project.version}/tmp/docker-build.tar
10 # which contains all files located in /target/docker/production and the artifacts.
11 # Artifacts are put into the folder maven/ inside the tar archive
12 # 3. The tar archive is passed to the dockerdaemon and is used as working directory for the build
13 #ADD target/docker/@project.groupId@/@project.artifactId@/@project.version@/build/maven/@project.build.finalName@.jar /root/cdm-server.jar
14 #ADD target/cdm-server-5.11.0-SNAPSHOT.jar /root/cdm-server.jar
15 ADD maven/@project.artifactId@-@project.version@.jar /root/cdm-server.jar
16
17 ARG CDMSERVER_PORT=8080
18 ARG HEAP_SIZE_ARG=1024M
19 ARG LOGDIR="/log/cdmserver"
20
21 ENV CDM_HOME=/data
22 ENV HEAP_SIZE=$HEAP_SIZE_ARG
23 ENV CPU_CORES=1
24 ENV DATASOURCES=$CDM_HOME/.cdmLibrary/datasources.xml
25
26 #set encoding
27 ENV LANG=en_US.UTF-8
28 ENV LANGUAGE=en_US:en
29 ENV LC_ALL=en_US.UTF-8
30
31 # java options which can be overwritten
32 ENV JAVA_OPTIONS="-Dspring.profiles.active=remoting"
33
34 # fixed java options which must not be overwritten
35 ENV JAVA_OPTS="-Xmx$HEAP_SIZE \
36 -XX:+UseG1GC -XX:ParallelGCThreads=$CPU_CORES -XX:ConcGCThreads=$CPU_CORES \
37 -Duser.home=$CDM_HOME \
38 -Dcdm.logDir=$LOGDIR"
39
40 ENV SERVER_ARGS="-forceSchemaUpdate -jmx"
41 ENV CDMSERVER_ARGS=" -httpPort=$CDMSERVER_PORT -datasources $DATASOURCES"
42
43 EXPOSE $CDMSERVER_PORT
44
45 RUN apt-get update; apt-get install -y openjdk-8-jre-headless libjemalloc1; apt-get clean
46 ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1
47
48
49 CMD java $JAVA_OPTS $JAVA_OPTIONS -jar /root/cdm-server.jar $SERVER_ARGS $CDMSERVER_ARGS