team-3/docker/Dockerfile

120 lines
4.3 KiB
Text
Raw Normal View History

2025-04-15 17:15:38 +00:00
# syntax=docker/dockerfile:1.15@sha256:05e0ad437efefcf144bfbf9d7f728c17818408e6d01432d9e264ef958bbd52f3
FROM ubuntu:noble-20250404@sha256:1e622c5f073b4f6bfad6632f2616c7f59ef256e96fe78bf6a595d1dc4376ac02 as base
ARG BASE_IMAGE_NAME=ubuntu:noble-20250404
ARG BASE_IMAGE_DIGEST=sha256:1e622c5f073b4f6bfad6632f2616c7f59ef256e96fe78bf6a595d1dc4376ac02
ARG TARGETARCH
LABEL org.opencontainers.image.base.name="docker.io/library/$BASE_IMAGE_NAME" \
org.opencontainers.image.base.digest="$BASE_IMAGE_DIGEST" \
org.opencontainers.image.source="https://github.com/c3nav/c3nav" \
org.opencontainers.image.url="https://c3nav.de" \
org.opencontainers.image.authors="c3nav team"
2023-07-14 05:42:26 +02:00
ENV DEBIAN_FRONTEND noninteractive
RUN --mount=type=cache,target=/var/cache/apt,id=apt_$TARGETARCH --mount=type=tmpfs,target=/var/lib/apt/lists \
rm /etc/apt/apt.conf.d/docker-clean && \
2023-07-14 05:42:26 +02:00
apt-get update && apt-get install -y --no-install-recommends \
2025-04-15 17:15:38 +00:00
python3.12=3.12.3-1ubuntu0.5 \
2024-12-03 20:59:25 +01:00
# renovate: srcname=python3.12
2025-04-15 17:15:38 +00:00
libpython3.12=3.12.3-1ubuntu0.5 \
2024-12-03 20:59:25 +01:00
# renovate: srcname=python3.12
2025-04-15 17:15:38 +00:00
python3.12-venv=3.12.3-1ubuntu0.5 \
# renovate: srcname=python-pip
2024-12-03 20:59:25 +01:00
python3-pip=24.0+dfsg-1ubuntu1.1 \
# renovate: srcname=postgresql-16
2025-04-15 17:15:38 +00:00
libpq5=16.8-0ubuntu0.24.04.1 \
2024-12-03 20:59:25 +01:00
# renovate: srcname=postgresql-16
2025-04-15 17:15:38 +00:00
postgresql-client-16=16.8-0ubuntu0.24.04.1 \
2024-12-17 02:02:16 +00:00
curl=8.5.0-2ubuntu10.6 \
2024-12-03 20:59:25 +01:00
# renovate: srcname=pcre3
libpcre3=2:8.39-15build1 \
# renovate: srcname=librsvg
2024-12-03 20:59:25 +01:00
librsvg2-2=2.58.0+dfsg-1build1 \
# renovate: srcname=librsvg
2024-12-03 20:59:25 +01:00
gir1.2-rsvg-2.0=2.58.0+dfsg-1build1 \
2024-12-04 20:20:27 +01:00
# renovate: srcname=cairo
libcairo2=1.18.0-3build1 \
2024-12-03 20:59:25 +01:00
libgirepository-1.0-1=1.80.1-1 \
2024-12-04 20:46:02 +01:00
# renovate: srcname=libmemcached
libmemcached11t64=1.1.4-1.1build3 \
gettext \
2024-12-03 20:59:25 +01:00
tzdata=2024a-3ubuntu1.1 \
ca-certificates=20240203 \
# renovate: srcname=libzstd
2024-12-03 20:59:25 +01:00
zstd=1.5.5+dfsg2-2build1.1
ENV PATH="/usr/lib/postgresql/16/bin/:$PATH"
2023-07-14 05:42:26 +02:00
FROM base as builder
RUN --mount=type=cache,target=/var/cache/apt,id=apt_$TARGETARCH --mount=type=tmpfs,target=/var/lib/apt/lists \
2023-07-14 05:42:26 +02:00
apt-get update && apt-get install -y --no-install-recommends \
2024-12-03 20:59:25 +01:00
build-essential=12.10ubuntu1 \
# renovate: srcname=python3.12
2025-04-15 17:15:38 +00:00
python3.12-dev=3.12.3-1ubuntu0.5 \
2024-12-03 20:59:25 +01:00
libpcre3-dev=2:8.39-15build1 \
# renovate: srcname=postgresql-16
2025-04-15 17:15:38 +00:00
libpq-dev=16.8-0ubuntu0.24.04.1 \
2024-12-04 20:20:27 +01:00
# renovate: srcname=cairo
libcairo2-dev=1.18.0-3build1 \
2024-12-03 20:59:25 +01:00
libgirepository1.0-dev=1.80.1-1 \
# renovate: srcname=libmemcached
2024-12-03 20:59:25 +01:00
libmemcached-dev=1.1.4-1.1build3
2023-07-14 05:42:26 +02:00
RUN mkdir /app
2023-07-14 05:42:26 +02:00
WORKDIR /app
RUN --mount=type=cache,target=/pip-cache \
--mount=type=bind,source=/src/requirements,target=/app/requirements \
2024-12-03 20:59:25 +01:00
python3.12 -m venv env && \
2023-07-14 05:42:26 +02:00
. /app/env/bin/activate && \
pip install --cache-dir /pip-cache --upgrade pip wheel && \
pip install --cache-dir /pip-cache \
-r requirements/production.txt \
-r requirements/htmlmin.txt \
-r requirements/postgres.txt \
-r requirements/redis.txt \
-r requirements/memcached.txt \
-r requirements/rsvg-pygobject.txt \
2023-11-27 05:33:06 +01:00
-r requirements/sentry.txt \
2024-03-29 23:38:04 +01:00
-r requirements/metrics.txt \
2024-09-06 21:15:08 +02:00
-r requirements/uwu.txt \
-r requirements/sso.txt \
2023-07-14 05:42:26 +02:00
-r requirements/server-asgi.txt && \
pip install --cache-dir /pip-cache uwsgi django_extensions
2023-07-14 05:42:26 +02:00
FROM base as final
ARG COMMIT
2023-07-14 05:42:26 +02:00
RUN groupadd -r -g 500 c3nav && useradd -r -u 500 -g 500 -G www-data c3nav
2023-11-26 23:08:06 +01:00
RUN mkdir /data /etc/c3nav && chown -R c3nav:c3nav /data /etc/c3nav
2023-07-14 05:42:26 +02:00
VOLUME /data
COPY --link --chown=500:500 /src /app
COPY --from=builder --chown=500:500 /app/env /app/env
COPY --chown=root:root --chmod=0755 /docker/entrypoint.sh /usr/bin/entrypoint
ENV C3NAV_DEBUG="" \
2023-11-29 19:48:09 +01:00
C3NAV_LOGLEVEL="INFO" \
2023-07-14 05:42:26 +02:00
C3NAV_DATA_DIR="/data" \
C3NAV_AUTOMIGRATE="yes" \
C3NAV_VERSION="${COMMIT}" \
2023-07-14 05:42:26 +02:00
MPLBACKEND="agg" \
UWSGI_WORKERS="4" \
2023-11-26 23:08:06 +01:00
PATH="/app/env/bin/:$PATH"
2023-07-14 05:42:26 +02:00
USER c3nav
WORKDIR /app
RUN /app/env/bin/python manage.py makemessages --ignore "site-packages" -l en_UW && \
2024-09-06 21:15:08 +02:00
/app/env/bin/python genuwu.py && \
/app/env/bin/python manage.py compilemessages --ignore "site-packages" && \
/app/env/bin/python manage.py collectstatic -l --no-input && \
2023-07-14 05:42:26 +02:00
/app/env/bin/python manage.py compress && \
rm -r /data/*
EXPOSE 8000 5000
#HEALTHCHECK --start-period=5s --interval=10s --timeout=1s CMD curl -f http://localhost:8000/check || exit 1
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["web"]