fix: use CPU-only PyTorch and run init_db before alembic migrations

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>
This commit is contained in:
root
2026-04-10 17:58:59 +02:00
parent 532932057f
commit afe420c620
2 changed files with 6 additions and 2 deletions

View File

@@ -24,7 +24,11 @@ WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r 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 . .