# Use pre-built base image with all dependencies
# Base image includes: Python 3.9, system deps, numpy, scipy, essentia-tensorflow, all pip deps
# Only rebuild base when requirements.txt changes
ARG BASE_IMAGE=git.benoitsz.com/benoit/audio-classifier-base:latest
FROM ${BASE_IMAGE}

# Working directory already set in base image
WORKDIR /app

# Copy application code
COPY backend/src/ ./src/
COPY backend/alembic.ini .

# Copy Essentia models into image (28 MB total)
COPY backend/models/ ./models/
RUN ls -lh /app/models

# Expose port
EXPOSE 8000

# Run migrations and start server
CMD alembic upgrade head && \
    uvicorn src.api.main:app --host 0.0.0.0 --port 8000
