Dockerfile 577 B

123456789101112131415161718192021222324252627
  1. # Pull base image
  2. FROM python:3.12.2-slim-bookworm
  3. # Set environment variables
  4. ENV PYTHONDONTWRITEBYTECODE 1
  5. ENV PYTHONUNBUFFERED 1
  6. # Create and set work directory called `app`
  7. RUN mkdir -p /code
  8. WORKDIR /code
  9. # Install dependencies
  10. COPY requirements.txt /tmp/requirements.txt
  11. RUN set -ex && \
  12. pip install --upgrade pip && \
  13. pip install -r /tmp/requirements.txt && \
  14. rm -rf /root/.cache/
  15. # Copy local project
  16. COPY . /code/
  17. # Expose port 8000
  18. EXPOSE 8000
  19. # Use gunicorn on port 8000
  20. CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "django_project.wsgi"]