-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (25 loc) · 862 Bytes
/
Dockerfile
File metadata and controls
35 lines (25 loc) · 862 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
# Use a stable Python image
FROM python:3.10-slim
# Prevent .pyc creation and improve logging
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install required system packages
RUN apt-get update && apt-get install -y \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy project files
COPY . .
# ⚠️ DO NOT run collectstatic during build in Railway
# Django settings will fail because DATABASE_URL is not present yet.
# Instead: let Railway run collectstatic via Release Phase.
RUN python manage.py collectstatic --noinput
# Run python manage.py migrate
EXPOSE 8000
# daphne build command
CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "backend.asgi:application"]