# Use Python slim image as base FROM python:3.11-slim # Set working directory WORKDIR /app # Copy requirements.txt first to leverage Docker cache COPY requirements.txt . # System packages RUN apt update && apt install -y wget tzdata # Timezone ENV TZ=Europe/Rome RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY app.py . COPY ingress.py . COPY models.py . # Copy entrypoint script and make it executable COPY entrypoint-web.sh . RUN chmod +x entrypoint-web.sh # Expose port (default 5000, can be overridden via PORT env var) EXPOSE 5000 # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PORT=5000 # Run gunicorn with the Flask app using the entrypoint script # The script handles PORT environment variable expansion # Using JSON array form for proper signal handling CMD ["./entrypoint-web.sh"]