FROM python:3.12-slim-bullseye COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ RUN useradd wagtail EXPOSE 8000 ENV PYTHONUNBUFFERED=1 \ PORT=8000 \ UV_COMPILE_BYTECODE=1 \ UV_LINK_MODE=copy RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ build-essential \ libpq-dev \ libjpeg62-turbo-dev \ zlib1g-dev \ libwebp-dev \ git \ && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv version && uv sync --locked --no-install-project WORKDIR /app ADD . /app RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --locked --no-dev RUN chown wagtail:wagtail /app USER wagtail ENV PATH="/app/.venv/bin:$PATH" RUN python manage.py collectstatic --noinput --clear CMD ["sh", "-c", "set -xe; python manage.py migrate --noinput && gunicorn dnscms.wsgi:application"]