# Dockerfile for a Django project FROM python:3.12-slim-bookworm # The installer requires curl (and certificates) to download the release archive RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && apt-get install libmagic-dev -y # Download the latest installer ADD https://astral.sh/uv/install.sh /uv-installer.sh # Run the installer then remove it RUN sh /uv-installer.sh && rm /uv-installer.sh # Ensure the installed binary is on the `PATH` ENV PATH="/root/.local/bin/:$PATH" ADD . /app # Set the working directory to /app WORKDIR /app # Make port 8010 available to the world outside this container EXPOSE 8020 # Define environment variable ENV DJANGO_SETTINGS_MODULE=config.settings.production ENV DJANGO_READ_DOT_ENV_FILE=True ENV DEBUG=False RUN uv sync --frozen --no-dev && uv run manage.py collectstatic --noinput # run gunicorn when the container launches # CMD ["uv", "run", "gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8010"] CMD ["uv", "run", "manage.py", "runserver", "0.0.0.0:8020"]