FROM python:3.11-slim

# Install PostgreSQL dev libraries and required packages
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

# Install required packages
RUN pip install psycopg[binary] mysql-connector-python cryptography passlib argon2-cffi

# Copy validation scripts
COPY database_functions/ /app/database_functions/
COPY validate_db.py /app/

# Set working directory
WORKDIR /app

# Set default environment variables for PostgreSQL (TEST ONLY - NOT SECURE)
ENV DB_TYPE=postgresql
ENV DB_HOST=postgres_db
ENV DB_PORT=5432
ENV DB_USER=postgres
ENV DB_PASSWORD=test_password_123
ENV DB_NAME=pinepods_database

# Run validator
CMD ["python", "validate_db.py", "--verbose"]