|
3 | 3 | # https://github.com/docker-library/buildpack-deps/blob/a0a59c61102e8b079d568db69368fb89421f75f2/jessie/curl/Dockerfile
|
4 | 4 | # https://github.com/docker-library/openjdk/blob/445f8b8d18d7c61e2ae7fda76d8883b5d51ae0a5/8-jre/Dockerfile
|
5 | 5 | FROM openjdk:8u121-jre
|
| 6 | + |
| 7 | +# Informs Docker that the container listens on the specified network ports at runtime. |
| 8 | +# See also: https://docs.docker.com/engine/reference/builder/#expose |
6 | 9 | EXPOSE 8080
|
7 |
| -COPY mystamps.war /tmp |
8 |
| -CMD [ "java", "-Dserver.address=0.0.0.0", "-jar", "/tmp/mystamps.war" ] |
| 10 | + |
| 11 | +# Sets active Spring profile. Possible values are: test, prod and travis. |
| 12 | +# See also: https://docs.docker.com/engine/reference/builder/#env |
| 13 | +ENV SPRING_PROFILES_ACTIVE=test |
| 14 | + |
| 15 | +# Creates base directories and unprivileged user. |
| 16 | +# See also: https://docs.docker.com/engine/reference/builder/#run |
| 17 | +RUN mkdir /data \ |
| 18 | + && useradd mystamps --home-dir /data/mystamps --create-home --comment 'MyStamps' \ |
| 19 | + && mkdir /data/uploads /data/heap-dumps \ |
| 20 | + && chown mystamps:mystamps /data/uploads /data/heap-dumps |
| 21 | + |
| 22 | +# Creates mount points and marks them as holding externally mounted volumes from native host. |
| 23 | +# See also: https://docs.docker.com/engine/reference/builder/#volume |
| 24 | +VOLUME /data/uploads /data/heap-dumps |
| 25 | + |
| 26 | +# Sets the user name to use when running the image and for any subsequent RUN, CMD and ENTRYPOINT instructions. |
| 27 | +# See also: https://docs.docker.com/engine/reference/builder/#user |
| 28 | +USER mystamps |
| 29 | + |
| 30 | +# Sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY and ADD instructions. |
| 31 | +# See also: https://docs.docker.com/engine/reference/builder/#workdir |
| 32 | +WORKDIR /data/mystamps |
| 33 | + |
| 34 | +# Copies mystamps.war into destination directory. File is created with a UID and GID of 0. |
| 35 | +# See also: https://docs.docker.com/engine/reference/builder/#copy |
| 36 | +COPY mystamps.war /data/mystamps |
| 37 | + |
| 38 | +# Sets the command to be executed during container startup. |
| 39 | +# See also: https://docs.docker.com/engine/reference/builder/#cmd |
| 40 | +CMD [ "java" \ |
| 41 | + , "-XX:+HeapDumpOnOutOfMemoryError" \ |
| 42 | + , "-XX:HeapDumpPath=/data/heap-dumps" \ |
| 43 | + , "-XX:+UseCompressedOops" \ |
| 44 | + , "-Dsun.rmi.dgc.client.gcInterval=86400000" \ |
| 45 | + , "-Dsun.rmi.dgc.server.gcInterval=86400000" \ |
| 46 | + , "-Djava.security.egd=file:/dev/./urandom" \ |
| 47 | + , "-Xmx128m" \ |
| 48 | + , "-Xss256k" \ |
| 49 | + , "-Dserver.address=0.0.0.0" \ |
| 50 | + , "-jar" \ |
| 51 | + , "mystamps.war" \ |
| 52 | +] |
0 commit comments