Replaced darkhttpd with lighttpd

This commit is contained in:
Kirmy 2021-12-09 13:09:09 +01:00 committed by Bastien Wirtz
parent caf5fae8a8
commit b6b31e440c
5 changed files with 35 additions and 10 deletions

View File

@ -12,18 +12,19 @@ RUN yarn build
# production stage # production stage
FROM alpine:3.15 FROM alpine:3.15
ENV USER darkhttpd ENV USER lighttpd
ENV GROUP darkhttpd ENV GROUP lighttpd
ENV GID 911 ENV GID 911
ENV UID 911 ENV UID 911
ENV PORT 8080 ENV PORT 8080
RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \
apk add -U --no-cache su-exec darkhttpd apk add -U --no-cache lighttpd
COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/ COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
COPY lighttpd.conf /lighttpd.conf
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1

View File

@ -21,19 +21,20 @@ FROM arm32v7/alpine:3.11
COPY --from=qemu qemu-arm-static /usr/bin/ COPY --from=qemu qemu-arm-static /usr/bin/
ENV USER darkhttpd ENV USER lighttpd
ENV GROUP darkhttpd ENV GROUP lighttpd
ENV GID 911 ENV GID 911
ENV UID 911 ENV UID 911
ENV PORT 8080 ENV PORT 8080
RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \
apk add -U --no-cache darkhttpd su-exec && \ apk add -U --no-cache lighttpd && \
rm /usr/bin/qemu-arm-static rm /usr/bin/qemu-arm-static
COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/ COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
COPY lighttpd.conf /lighttpd.conf
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1

View File

@ -21,19 +21,20 @@ FROM arm64v8/alpine:3.11
COPY --from=qemu qemu-aarch64-static /usr/bin/ COPY --from=qemu qemu-aarch64-static /usr/bin/
ENV USER darkhttpd ENV USER lighttpd
ENV GROUP darkhttpd ENV GROUP lighttpd
ENV GID 911 ENV GID 911
ENV UID 911 ENV UID 911
ENV PORT 8080 ENV PORT 8080
RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \
apk add -U --no-cache darkhttpd su-exec && \ apk add -U --no-cache lighttpd && \
rm /usr/bin/qemu-aarch64-static rm /usr/bin/qemu-aarch64-static
COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/ COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
COPY lighttpd.conf /lighttpd.conf
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1

View File

@ -18,4 +18,6 @@ if [[ -n "${SUBFOLDER}" ]]; then
fi fi
chown -R $UID:$GID /www/assets chown -R $UID:$GID /www/assets
exec su-exec $UID:$GID darkhttpd /www/ --no-listing --port "$PORT"
echo "Starting webserver"
lighttpd -D -f /lighttpd.conf

20
lighttpd.conf Normal file
View File

@ -0,0 +1,20 @@
# Minimal config by Kirmy34
include "/etc/lighttpd/mime-types.conf"
server.port = 8080
server.username = "lighttpd"
server.groupname = "lighttpd"
server.document-root = "/www"
server.pid-file = "/run/lighttpd.pid"
server.indexfiles = ("index.php", "index.html", "index.htm", "default.htm")
server.follow-symlink = "enable"
static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
url.access-deny = ("~", ".inc")