freekake_api/Dockerfile
2025-06-30 13:27:48 +07:00

29 lines
769 B
Docker

# Use an official Python runtime as a base image
FROM python:3.13.5-slim-bookworm
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y build-essential libpq-dev && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt /app/
RUN pip install --upgrade pip && pip install -r requirements.txt
# Copy project
COPY . /app/
WORKDIR /app
# Run migrations & collect static in production (optional)
# CMD ["python", "manage.py", "migrate"] && ["python", "manage.py", "collectstatic", "--noinput"]
# Command to run the server
CMD ["gunicorn", "freekake_api.wsgi:application", "--bind", "0.0.0.0:8000"]