| # Use the official lightweight Python image. | |
| # https://hub.docker.com/_/python | |
| FROM python:3.9-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| # Create and set working directory | |
| WORKDIR /app | |
| RUN apt-get update \ | |
| && apt-get install wkhtmltopdf -y \ | |
| && mv /usr/bin/wkhtmltopdf /usr/local/bin/. | |
| # Copy system package requirements file | |
| COPY packages.txt . | |
| RUN apt-get update | |
| # Copy the application requirements file | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the application code | |
| COPY . . | |
| # Expose the Streamlit port | |
| EXPOSE 8501 | |
| # Run Streamlit app | |
| CMD ["streamlit", "run", "app.py"] | |