# Use Python 3.11 slim image
FROM python:3.11-slim

# Surface the build version to the application
ENV APP_VERSION=${BUILD_VERSION}

# Set working directory
WORKDIR /app

# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt

# Copy application code
COPY . .

# Force rebuild - change this timestamp when you want to rebuild
ARG BUILD_VERSION=1.0.0.10

# Record build version for runtime fallback
RUN echo "${BUILD_VERSION}" > /app/.build-version

# Expose port 8000
EXPOSE 8000

# Run the application with live reload for development
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
