# Dockerfile for Dereth Tracker application
FROM python:3.12-slim

# Set working directory
WORKDIR /app

# Upgrade pip and install Python dependencies
RUN python -m pip install --upgrade pip && \
    pip install --no-cache-dir fastapi uvicorn pydantic pandas matplotlib websockets

# Copy application code
COPY static/ /app/static/
COPY main.py /app/main.py
COPY db.py /app/db.py
COPY Dockerfile /Dockerfile
# Expose the application port
EXPOSE 8765

# Default environment variables (override as needed)
ENV DB_MAX_SIZE_MB=2048 \
    DB_RETENTION_DAYS=7 \
    DB_MAX_SQL_LENGTH=1000000000 \
    DB_MAX_SQL_VARIABLES=32766 \
    DB_WAL_AUTOCHECKPOINT_PAGES=1000 \
    SHARED_SECRET=your_shared_secret

# Run the FastAPI application with Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8765", "--reload", "--workers", "1"]
