Rework container build to use upstream Alpine image instead of Python

This commit is contained in:
Yannik Rödel 2025-10-29 03:41:20 +01:00
parent 3dc5f85670
commit 6ff06c2e92

View file

@ -25,12 +25,15 @@ RUN SITE=${SITE} npm run build:site
# #
# Actual server container # Actual server container
# #
FROM docker.io/python:3.14-alpine FROM docker.io/library/alpine:latest
ARG SITE ARG SITE
RUN apk add --no-cache lighttpd && \
apk add --no-cache python3 py3-requests py3-itsdangerous py3-magic
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
apk add --no-cache lighttpd && \ apk add --no-cache py3-pip && \
python -m pip install legacy-cgi itsdangerous requests python-libmagic python3 -m pip install legacy-cgi --break-system-packages && \
apk del py3-pip
COPY --from=build /build/dist /www/ COPY --from=build /build/dist /www/
COPY cgi-bin /cgi-bin/ COPY cgi-bin /cgi-bin/
@ -38,7 +41,7 @@ COPY sites/${SITE}/httpd.conf /httpd.conf
COPY sites/${SITE}/_data/config.json /config.json COPY sites/${SITE}/_data/config.json /config.json
RUN sed -i \ RUN sed -i \
-e "s,@python@,/usr/local/bin/python,g" \ -e "s,@python@,/usr/bin/python3,g" \
-e "s,@site@,/www,g" \ -e "s,@site@,/www,g" \
-e "s,@cgibin@,/cgi-bin,g" \ -e "s,@cgibin@,/cgi-bin,g" \
/httpd.conf /httpd.conf
@ -50,7 +53,7 @@ ENV ZAMMAD_URL=https://ticket.z31.it
ENV ZAMMAD_GROUP="" ENV ZAMMAD_GROUP=""
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1/ || exit 1 CMD curl -sSf http://127.0.0.1/ > /dev/null || exit 1
# Reroute stdout to a new file descriptor so that Lighttpd can use it as the # Reroute stdout to a new file descriptor so that Lighttpd can use it as the
# access log. See http.conf and here: # access log. See http.conf and here: