PyTorch default install pulls ~7GB of CUDA libs, exceeding disk on small VMs. Switching to CPU-only saves ~6GB. Also run create_all before alembic so migrations find existing tables on a fresh Postgres. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.2 KiB
Docker
43 lines
1.2 KiB
Docker
FROM python:3.12-slim
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
# Build dependencies
|
|
gcc \
|
|
g++ \
|
|
make \
|
|
# Image processing libraries
|
|
libvips42 \
|
|
libvips-dev \
|
|
# ExifTool for metadata extraction
|
|
libimage-exiftool-perl \
|
|
# FFmpeg for video processing
|
|
ffmpeg \
|
|
# Git for some Python packages
|
|
git \
|
|
# PostgreSQL client (for potential future use)
|
|
postgresql-client \
|
|
# Clean up
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
# Install PyTorch CPU-only FIRST so open-clip-torch doesn't pull the full
|
|
# CUDA build (~7 GB). CPU inference is all we need — the heavy lifting
|
|
# happens through ONNX Runtime.
|
|
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu \
|
|
&& pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /data/thumbs /data/db /data/proxies /data/models /app/config
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Run the application
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] |