Dockerfile 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # Define a base stage that uses the official python runtime base image
  2. FROM python:3.11-slim AS base
  3. # Add curl for healthcheck
  4. RUN apt-get update && \
  5. apt-get install -y --no-install-recommends curl && \
  6. rm -rf /var/lib/apt/lists/*
  7. # Set the application directory
  8. WORKDIR /usr/local/app
  9. # Install our requirements.txt
  10. COPY requirements.txt ./requirements.txt
  11. RUN pip install --no-cache-dir -r requirements.txt
  12. # Define a stage specifically for development, where it'll watch for
  13. # filesystem changes
  14. FROM base AS dev
  15. RUN pip install watchdog
  16. ENV FLASK_ENV=development
  17. CMD ["python", "app.py"]
  18. # Define the final stage that will bundle the application for production
  19. FROM base AS final
  20. # Copy our code from the current folder to the working directory inside the container
  21. COPY . .
  22. # Make port 80 available for links and/or publish
  23. EXPOSE 80
  24. # Define our command to be run when launching the container
  25. CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--log-file", "-", "--access-logfile", "-", "--workers", "4", "--keep-alive", "0"]