File size: 1,444 Bytes
4c0ed2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5915333
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
# ── NoteGrabber API — Docker image ───────────────────────────────────────────
# Builds a lean production image for studio.cloudfom.org's Note Grabber backend.
#
# Build:  docker build -t notegrabber-api .
# Run:    docker run -p 8000:8000 notegrabber-api
# ─────────────────────────────────────────────────────────────────────────────

FROM python:3.11-slim

# System dependencies needed by librosa / soundfile (used by basic-pitch)
RUN apt-get update && apt-get install -y --no-install-recommends \
    libsndfile1 \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python dependencies first (layer-cached unless requirements change)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY main.py .

# Pre-download the basic-pitch model weights at build time so cold-starts
# don't hit the network at runtime. (The model is ~30 MB.)
RUN python -c "from basic_pitch import ICASSP_2022_MODEL_PATH; print('Model path:', ICASSP_2022_MODEL_PATH)"

EXPOSE 8000

# Use --workers 2 in production (CPU-bound; more workers = more RAM for models)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]