Use uv to manage requirements
This commit is contained in:
parent
e95c2a440e
commit
a041d5f7fa
15 changed files with 998 additions and 1334 deletions
|
|
@ -12,10 +12,10 @@ RUN mkdir /app/src
|
|||
RUN mkdir /app/logs
|
||||
RUN mkdir /app/media
|
||||
|
||||
COPY ./requirements /app/requirements
|
||||
COPY uv.lock pyproject.toml /app/
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
||||
RUN uv pip install --system --requirement requirements/base.txt
|
||||
RUN uv sync --frozen --no-install-project
|
||||
|
||||
|
||||
# stage 2
|
||||
|
|
@ -48,8 +48,9 @@ RUN mkdir /app/logs
|
|||
RUN mkdir /app/media
|
||||
RUN mkdir /app/bin
|
||||
|
||||
COPY --from=backend /usr/local/lib/python3.11 /usr/local/lib/python3.11
|
||||
COPY --from=backend /usr/local/bin/celery /usr/local/bin/celery
|
||||
COPY --from=backend /app/.venv /app/.venv
|
||||
COPY --from=backend /app/uv.lock /app/pyproject.toml /app/
|
||||
COPY --from=backend /bin/uv /bin/uv
|
||||
|
||||
COPY ./bin/docker-entrypoint.sh /app/bin/docker-entrypoint.sh
|
||||
|
||||
|
|
@ -57,10 +58,7 @@ COPY --from=frontend-build /app/src/newsreader/static /app/src/newsreader/static
|
|||
|
||||
COPY ./src /app/src
|
||||
|
||||
COPY ./requirements /app/requirements
|
||||
|
||||
COPY --from=backend /bin/uv /bin/uv
|
||||
RUN uv pip install --system --requirement requirements/production.txt
|
||||
RUN uv sync --frozen --extra production
|
||||
|
||||
RUN useradd -M -u 1000 newsreader
|
||||
RUN chown -R newsreader:newsreader /app
|
||||
|
|
@ -78,7 +76,7 @@ ARG DJANGO_SETTINGS_MODULE
|
|||
# Note that the static volume will have to be recreated to be pre-populated
|
||||
# correctly with the latest static files. See
|
||||
# https://docs.docker.com/storage/volumes/#populate-a-volume-using-a-container
|
||||
RUN python src/manage.py collectstatic --noinput
|
||||
RUN /app/.venv/bin/python src/manage.py collectstatic --noinput
|
||||
|
||||
|
||||
# (optional) stage 4
|
||||
|
|
@ -95,14 +93,13 @@ RUN mkdir /app/logs
|
|||
RUN mkdir /app/media
|
||||
RUN mkdir /app/bin
|
||||
|
||||
COPY ./requirements /app/requirements
|
||||
COPY --from=backend /app/.venv /app/.venv
|
||||
COPY --from=backend /app/uv.lock /app/pyproject.toml /app/
|
||||
COPY ./bin/docker-entrypoint.sh /app/bin/docker-entrypoint.sh
|
||||
COPY --from=backend /usr/local/lib/python3.11 /usr/local/lib/python3.11
|
||||
COPY --from=backend /usr/local/bin/celery /usr/local/bin/celery
|
||||
COPY --from=backend /app/src/ /app/src/
|
||||
|
||||
COPY --from=backend /bin/uv /bin/uv
|
||||
RUN uv pip install --system --requirement requirements/development.txt
|
||||
RUN uv sync --frozen --extra testing --extra development
|
||||
|
||||
RUN useradd -M -u 1000 newsreader
|
||||
RUN chown -R newsreader:newsreader /app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue