File size: 1,448 Bytes
f0a176a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56c8033
645dc08
 
 
 
124d7f4
56c8033
f0a176a
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM node:20-slim AS frontend

WORKDIR /build
COPY app/package.json app/package-lock.json* ./
RUN npm ci
COPY app/ .
RUN npm run build

# --- Python backend ---
FROM python:3.12-slim

# System deps: ffmpeg for audio processing, yt-dlp needs it too
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python dependencies
# basic-pitch pulls in tensorflow on Linux, but we only use ONNX runtime.
# Install it with --no-deps and manually specify what we need.
COPY api/requirements.txt /app/api/requirements.txt
RUN pip install --no-cache-dir \
    fastapi uvicorn[standard] python-multipart \
    onnxruntime pretty_midi librosa scipy numpy "setuptools<81" \
    yt-dlp mir-eval resampy scikit-learn && \
    pip install --no-cache-dir --no-deps basic-pitch

# Install Demucs for full-song source separation (CPU-only PyTorch)
# Must install torch+torchaudio from CPU index FIRST, then demucs,
# otherwise demucs pulls CUDA torchaudio from PyPI (2GB+).
RUN pip install --no-cache-dir \
    torch torchaudio --index-url https://download.pytorch.org/whl/cpu && \
    pip install --no-cache-dir torchcodec demucs

# Copy application code
COPY transcriber/ /app/transcriber/
COPY api/ /app/api/

# Copy built frontend
COPY --from=frontend /build/dist /app/app/dist

ENV PORT=7860
EXPOSE 7860

CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]