Packaging fixes

This commit is contained in:
badblocks 2025-05-08 21:08:12 -07:00
parent fa6103d007
commit 959b06c425
19 changed files with 389 additions and 68 deletions

View file

@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.9
### Start build prep.
### This should be a separate build container for better reuse.
FROM python:3.13-slim-bookworm AS build
FROM mcr.microsoft.com/playwright/python:v1.52.0-noble AS build
# The following does not work in Podman unless you build in Docker
# compatibility mode: <https://github.com/containers/podman/issues/8477>
@ -20,7 +20,7 @@ COPY --from=ghcr.io/astral-sh/uv:0.7.2 /uv /usr/local/bin/uv
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
UV_PYTHON=python3.13 \
UV_PYTHON=python3.12 \
UV_PROJECT_ENVIRONMENT=/app
# Synchronize DEPENDENCIES without the application itself.
@ -40,28 +40,24 @@ RUN --mount=type=cache,target=/root/.cache \
# Now install the rest from `/src`: The APPLICATION w/o dependencies.
# `/src` will NOT be copied into the runtime container.
# LEAVE THIS OUT if your application is NOT a proper Python package.
# COPY . /src
# WORKDIR /src
# RUN --mount=type=cache,target=/root/.cache \
# uv sync \
# --locked \
# --no-dev \
# --no-editable
COPY . /src
WORKDIR /src
RUN --mount=type=cache,target=/root/.cache \
uv sync \
--locked \
--no-dev \
--no-editable
### End build prep
##########################################################################
FROM python:3.13-slim-bookworm
FROM mcr.microsoft.com/playwright/python:v1.52.0-noble
SHELL ["sh", "-exc"]
ARG ENV_FILE=.env.production
ENV PATH=/app/bin:$PATH
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV HOME=/code
ENV DJANGO_SETTINGS_MODULE=django_project.settings
ENV HOME=/app
WORKDIR /app
@ -87,19 +83,6 @@ STOPSIGNAL SIGINT
COPY --from=build --chown=app:app /app /app
RUN playwright install --with-deps
# If your application is NOT a proper Python package that got
# pip-installed above, you need to copy your application into
# the container HERE and set the WORKDIR:
COPY --chown=app:app ./ /code
WORKDIR /code
ENV PYTHONPATH=/code
# WORKDIR /app # if python-packaged
RUN rm -f .env
COPY ${ENV_FILE} .env
COPY --chown=app:app --chmod=700 /scripts/entrypoint.sh /entrypoint.sh
COPY --chown=app:app --chmod=700 /scripts/deploy.sh /deploy.sh