-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (26 loc) · 952 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (26 loc) · 952 Bytes
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
# Supported base (Debian Bookworm) – no EOL repos
FROM python:3.11-slim-bookworm
# Python behavior
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# System deps (drop version pins)
# If you use psycopg2-binary, you can remove build-essential/libpq-dev/pkg-config.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
pkg-config \
dnsutils \
&& rm -rf /var/lib/apt/lists/*
# App dir
WORKDIR /app
# Install Python deps first (layer cache)
COPY requirements.txt .
RUN python -m pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy project
COPY . /app
# Django port (adjust if different)
EXPOSE 8000
# Run DB migrations at container start (not at build time)
# Assumes manage.py is at /app/manage.py and wsgi module is pygoat.wsgi
CMD ["sh", "-c", "python manage.py migrate && gunicorn --bind 0.0.0.0:8000 --workers 6 pygoat.wsgi"]