FROM python:3.11-slim

WORKDIR /app

# Copy only the necessary subdirectory
COPY . /app

# Install system dependencies (for psycopg2 and similar packages)
RUN apt-get update && apt-get install -y \
    curl \
    gnupg \
    gcc \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*

# Set up venv, install requirements
RUN python -m venv /py_venv \
    && /py_venv/bin/pip install --upgrade pip \
    && /py_venv/bin/pip install -r post_processing/py/requirements.txt

ENV PYTHONPATH=/app/post_processing/py/utils:/app/post_processing/py/graphs

# Run the script using the virtual environment
WORKDIR /app/post_processing/py
CMD ["/py_venv/bin/python", "utils/redirect2.py"]
