aboutsummaryrefslogtreecommitdiffhomepage
path: root/Dockerfile
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2022-04-10 11:55:11 +0200
committerBastien Wirtz <bastien.wirtz@gmail.com>2022-04-30 15:39:36 +0200
commit049f85221e945b90bf87d21afe4d306839d65740 (patch)
tree1288ab580f2a274df8b507e2bbe37e2ff03c70ca /Dockerfile
parentcd75da69f9e57c3fe0f63c3ed6def0577d75a47c (diff)
downloadhomer-049f85221e945b90bf87d21afe4d306839d65740.tar.gz
homer-049f85221e945b90bf87d21afe4d306839d65740.tar.zst
homer-049f85221e945b90bf87d21afe4d306839d65740.zip
Simplify the container starting process to allow it to run with a
unprivileged user
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile20
1 files changed, 12 insertions, 8 deletions
diff --git a/Dockerfile b/Dockerfile
index ffe50c4..0e9d51a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,24 +12,28 @@ RUN yarn build
12# production stage 12# production stage
13FROM alpine:3.15 13FROM alpine:3.15
14 14
15ENV USER lighttpd 15ENV GID 1000
16ENV GROUP lighttpd 16ENV UID 1000
17ENV GID 911
18ENV UID 911
19ENV PORT 8080 17ENV PORT 8080
20ENV SUBFOLDER "/_" 18ENV SUBFOLDER "/_"
19ENV INIT_ASSETS 1
21 20
22RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ 21RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd && \
23 apk add -U --no-cache lighttpd 22 apk add -U --no-cache lighttpd
24 23
25COPY entrypoint.sh /entrypoint.sh 24WORKDIR /www
26COPY lighttpd.conf /lighttpd.conf
27 25
28COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/ 26COPY lighttpd.conf /lighttpd.conf
27COPY entrypoint.sh /entrypoint.sh
28COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/
29COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets 29COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
30
31USER ${UID}:${GID}
32
30HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ 33HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
31 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 34 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1
32 35
33EXPOSE ${PORT} 36EXPOSE ${PORT}
34VOLUME /www/assets 37VOLUME /www/assets
38
35ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] 39ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]