-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
Dockerfile
88 lines (77 loc) · 2.32 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
ARG FOUNDRY_PASSWORD
ARG FOUNDRY_RELEASE_URL
ARG FOUNDRY_USERNAME
ARG FOUNDRY_VERSION=0.7.9
ARG VERSION
FROM node:12-alpine as optional-release-stage
ARG FOUNDRY_PASSWORD
ARG FOUNDRY_RELEASE_URL
ARG FOUNDRY_USERNAME
ARG FOUNDRY_VERSION
ENV ARCHIVE="foundryvtt-${FOUNDRY_VERSION}.zip"
WORKDIR /root
COPY \
src/authenticate.js \
src/get_release_url.js \
src/logging.js \
src/package.json \
./
# .placeholder file to mitigate https://github.com/moby/moby/issues/37965
RUN mkdir dist && touch dist/.placeholder
RUN \
if [ -n "${FOUNDRY_USERNAME}" ] && [ -n "${FOUNDRY_PASSWORD}" ]; then \
npm install && \
./authenticate.js "${FOUNDRY_USERNAME}" "${FOUNDRY_PASSWORD}" cookiejar.json && \
s3_url=$(./get_release_url.js cookiejar.json "${FOUNDRY_VERSION}") && \
wget -O ${ARCHIVE} "${s3_url}" && \
unzip -d dist ${ARCHIVE} 'resources/*'; \
elif [ -n "${FOUNDRY_RELEASE_URL}" ]; then \
wget -O ${ARCHIVE} "${FOUNDRY_RELEASE_URL}" && \
unzip -d dist ${ARCHIVE} 'resources/*'; \
fi
FROM node:12-alpine as final-stage
ARG FOUNDRY_UID=421
ARG FOUNDRY_VERSION
ARG TARGETPLATFORM
ARG VERSION
LABEL com.foundryvtt.version=${FOUNDRY_VERSION}
LABEL org.opencontainers.image.authors="markf+github@geekpad.com"
LABEL org.opencontainers.image.vendor="Geekpad"
ENV FOUNDRY_HOME="/home/foundry"
ENV FOUNDRY_VERSION=${FOUNDRY_VERSION}
WORKDIR ${FOUNDRY_HOME}
COPY --from=optional-release-stage /root/dist/ .
COPY \
src/authenticate.js \
src/check_health.sh \
src/entrypoint.sh \
src/get_license.js \
src/get_release_url.js \
src/launcher.sh \
src/logging.js \
src/logging.sh \
src/package.json \
src/set_options.js \
src/set_password.js \
./
RUN addgroup --system --gid ${FOUNDRY_UID} foundry \
&& adduser --system --uid ${FOUNDRY_UID} --ingroup foundry foundry \
&& apk --update --no-cache add \
curl \
jq \
sed \
su-exec \
tzdata \
&& npm install && echo ${VERSION} > image_version.txt
VOLUME ["/data"]
# HTTP Server
EXPOSE 30000/TCP
# TURN Server
# Not exposing TURN ports due to bug in Docker.
# See: https://github.com/moby/moby/issues/11185
# EXPOSE 33478/UDP
# EXPOSE 49152-65535/UDP
ENTRYPOINT ["./entrypoint.sh"]
CMD ["resources/app/main.js", "--port=30000", "--headless", "--noupdate",\
"--dataPath=/data"]
HEALTHCHECK --start-period=3m --interval=30s --timeout=5s CMD ./check_health.sh