stash
This commit is contained in:
parent
0f51f6e33f
commit
419893d93d
11 changed files with 925 additions and 72 deletions
27
deploy/prod/Dockerfile.backend
Normal file
27
deploy/prod/Dockerfile.backend
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Production image for the Django backend.
|
||||
# Runs migrations then serves the app with gunicorn on port 8000.
|
||||
# Static files are collected at build time into /app/staticfiles and
|
||||
# served by the backend itself behind the host nginx reverse proxy.
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
DJANGO_SETTINGS_MODULE=backend.settings
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --upgrade pip \
|
||||
&& pip install --no-cache-dir -r requirements.txt gunicorn
|
||||
|
||||
COPY . .
|
||||
|
||||
# collectstatic only needs Django settings to import cleanly, not a real
|
||||
# secret; the actual SECRET_KEY is injected at container runtime via
|
||||
# --env-file and overrides this.
|
||||
RUN SECRET_KEY=build-time-placeholder python manage.py collectstatic --noinput
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["sh", "-c", "python manage.py migrate --noinput && exec gunicorn backend.wsgi:application --bind 0.0.0.0:8000 --workers 3"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue