23 lines
685 B
Docker
23 lines
685 B
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.11-slim
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Install curl for health check
|
|
RUN apt-get update && apt-get install -y curl libmagic1t64 && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY . .
|
|
|
|
# Install any needed packages specified in requirements.txt
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Make port 80 available to the world outside this container
|
|
EXPOSE 80
|
|
|
|
# Add health check
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl http://localhost || exit 1
|
|
|
|
# Run the application using Gunicorn
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:80", "--workers", "4", "wsgi:app"]
|