FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

# Copy the wheel and install it
# Note: The context should be the project root to access the dist folder
COPY dist/*.whl /tmp/
RUN pip install /tmp/*.whl

# Install app dependencies
COPY examples/core_test_app/requirements.txt .
RUN pip install -r requirements.txt

# Copy application code
COPY examples/core_test_app/main.py .

EXPOSE 8000

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV ENVIRONMENT=development

CMD ["python", "main.py"]
