This commit is contained in:
MonkeyStrongTogether
2026-05-22 17:57:23 +02:00
parent 87ec426fed
commit f83f73d6cf
5 changed files with 195 additions and 0 deletions

42
Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
FROM python:3.14-slim-bookworm
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
DJANGO_SETTINGS_MODULE=config.settings
# Set work directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy project files
COPY . .
# Create necessary directories
RUN mkdir -p /app/staticfiles /app/static /app/media
# Collect static files
RUN python manage.py collectstatic --noinput
# Create a non-root user
RUN addgroup --system app && adduser --system --group app
RUN chown -R app:app /app
USER app
EXPOSE 8000
# Use Daphne for WebSocket support
CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "config.asgi:application"]