blob: 9dea447f2e7b9f2998ee061bc3f8dfe75affdfe3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# 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"]
|