-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (27 loc) · 1000 Bytes
/
Dockerfile
File metadata and controls
40 lines (27 loc) · 1000 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
34
35
36
37
38
39
40
# syntax=docker/dockerfile:1
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# System deps (add others you actually need, e.g. libpq-dev already here)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gcc curl netcat-traditional libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Faster layer caching for deps
COPY requirements.txt .
RUN python -m pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir gunicorn
RUN pip install setuptools
# App source
COPY . .
# create non-root user that can write /app
RUN useradd -m -u 1000 -s /usr/sbin/nologin django \
&& chown -R 1000:1000 /app
USER 1000:1000
# Make entrypoint executable
RUN chmod 0755 /app/docker-entrypoint.sh
EXPOSE 8000
ENV DJANGO_SETTINGS_MODULE=gnext.settings
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["gunicorn", "gnext.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"]