Configuration Files
2 files
Production-ready configuration files with detailed comments and best practices. Each file works together as a complete deployment solution.
Production-ready Django Dockerfile
dockerfile
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project
COPY . .
# Collect static files
RUN python manage.py collectstatic --noinput
# Run as non-root
RUN useradd -m django && chown -R django:django /app
USER django
EXPOSE 8000
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "4"] Django production dependencies
text
Django==5.0 gunicorn==21.2.0 psycopg2-binary==2.9.9 whitenoise==6.6.0 django-environ==0.11.2