# Use official Python runtime as a parent image FROM python:3.12-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PORT=8501 # Set working directory WORKDIR /app # Install system dependencies (curl for health checks) RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies # We reuse the root requirements.txt for simplicity, or we could have a specific one COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Create a non-root user and switch to it for security RUN useradd -m appuser && chown -R appuser /app USER appuser # Expose Streamlit's default port EXPOSE 8501 # Command to run the Streamlit app CMD streamlit run frontend/app.py --server.port=$PORT --server.address=0.0.0.0