37 lines
893 B
Docker
37 lines
893 B
Docker
# Django Backend Dockerfile
|
|
FROM python:3.12-slim
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
gcc \
|
|
postgresql-client \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt /app/
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project
|
|
COPY . /app/
|
|
|
|
# Create directories for media and static files
|
|
RUN mkdir -p /app/media /app/staticfiles /app/logs
|
|
|
|
# Collect static files (will be done at runtime if needed)
|
|
# RUN python manage.py collectstatic --noinput
|
|
|
|
# Expose port
|
|
EXPOSE 1086
|
|
|
|
# Run gunicorn
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:1086", "--workers", "3", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "gnx.wsgi:application"]
|
|
|