forked from thewca/tnoodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (27 loc) · 1.58 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# We select the base image from. Locally available or from https://hub.docker.com/
FROM openjdk:8-jre-alpine
RUN apk add --no-cache fontconfig ttf-dejavu
RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so && \
ln -s /lib/libuuid.so.1 /usr/lib/libuuid.so.1 && \
ln -s /lib/libc.musl-x86_64.so.1 /usr/lib/libc.musl-x86_64.so.1
ENV LD_LIBRARY_PATH /usr/lib
# We define the user we will use in this instance to prevent using root that even in a container, can be a security risk.
ENV APPLICATION_USER=ktor
# Then we add the user, create the /app folder and give permissions to our user.
RUN adduser -D -g '' $APPLICATION_USER
RUN mkdir /app
RUN chown -R $APPLICATION_USER /app
# Marks this container to use the specified $APPLICATION_USER
USER $APPLICATION_USER
# We copy the FAT Jar we built into the /app folder and sets that folder as the working directory.
COPY ./TNoodle-Build-latest.jar /app/tnoodle-application.jar
WORKDIR /app
# allow deployments to online Docker containers
# (requires TNoodle to mangle with Java runtime, see WebscramblesServer#main for details)
ARG ONLINE
# If the arg ONLINE was passed, add flag
ENV ONLINE_MODE=${ONLINE:+"--online"}
# If no flag is present yet, explicitly assign an empty string
ENV ONLINE_MODE=${ONLINE_MODE:-""}
# We launch java to execute the jar, with good defauls intended for containers.
CMD java -server -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:InitialRAMFraction=2 -XX:MinRAMFraction=2 -XX:MaxRAMFraction=2 -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+UseStringDeduplication -jar tnoodle-application.jar $ONLINE_MODE