dnscms: migrate to uv, remove wagtail-wordpress-import dependency

This commit is contained in:
2025-07-21 03:52:30 +02:00
parent 90f658a77e
commit a7bbc0730d
13 changed files with 695 additions and 1272 deletions

View File

@@ -1,11 +1,14 @@
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
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 \
@@ -13,29 +16,25 @@ RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-r
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
git \
&& rm -rf /var/lib/apt/lists/*
ENV POETRY_VERSION=""
ENV POETRY_HOME="/opt/poetry"
ENV PIP_NO_CACHE_DIR=1
ENV POETRY_VIRTUALENVS_CREATE=false
ENV POETRY_NO_INTERACTION=1
ENV PATH="$POETRY_HOME/bin:$PATH"
WORKDIR /app
RUN apt-get update \
&& apt-get install --no-install-recommends --assume-yes curl
RUN curl -sSL https://install.python-poetry.org | python3 -
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
COPY pyproject.toml poetry.lock README.md /app/
RUN pip install gunicorn
RUN poetry install --without=dev
COPY . /app
ADD . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
RUN chown wagtail:wagtail /app
COPY --chown=wagtail:wagtail . .
USER wagtail
ENV PATH="/app/.venv/bin:$PATH"
RUN python manage.py collectstatic --noinput --clear
CMD set -xe; python manage.py migrate --noinput && gunicorn dnscms.wsgi:application
CMD ["sh", "-c", "set -xe; python manage.py migrate --noinput && gunicorn dnscms.wsgi:application"]