# Use Python 3.11 slim image from Harbor
FROM harbor.dvirlabs.com/base-images/python:3.11-slim

# Set working directory
WORKDIR /app

# Copy requirements file and pre-downloaded wheels
COPY requirements.txt .
COPY wheels/ /tmp/wheels/

# Install Python dependencies from local wheels (no internet needed)
# --no-index = Don't use PyPI
# --find-links = Look for packages in /tmp/wheels
RUN pip install --no-cache-dir --no-index --find-links /tmp/wheels -r requirements.txt && \
    rm -rf /tmp/wheels

# Copy application code
COPY . .

# Create uploads directory for product images
RUN mkdir -p /app/uploads/products

# Expose port 8000
EXPOSE 8000

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
