FROM python:3.12-slim

# Install system dependencies for beets plugins
RUN apt-get update && apt-get install -y \
    # For chromaprint/acoustid fingerprinting
    libchromaprint-tools \
    # For media file handling
    ffmpeg \
    # Build tools for some Python packages
    gcc \
    g++ \
    && rm -rf /var/lib/apt/lists/*

# Create app directory
WORKDIR /app

# Copy dependency files
COPY pyproject.toml ./

# Install Poetry
RUN pip install --no-cache-dir poetry

# Configure Poetry to not create virtual env (we're in container)
RUN poetry config virtualenvs.create false

# Install dependencies
RUN poetry install --no-root --no-interaction --no-ansi

# Copy config
COPY config.yaml /etc/beets/config.yaml

# Create data directories
RUN mkdir -p /data/Music /data/Inbox

# Set environment
ENV BEETS_CONFIG=/etc/beets/config.yaml

# Default command
CMD ["beet", "--help"]
