Files
family_home_lab/transcriber/Dockerfile

31 lines
1.2 KiB
Docker

# Dedicated transcription worker (Spotify Basic Pitch -> MIDI).
# Separate from the main worker so runtime-heavy deps (tensorflow) don't bloat it.
#
# NOTE: basic-pitch pins tensorflow<2.15.1 which has NO Python 3.12 wheels, and
# forcing a source build of old numpy fails on py3.12 (pkgutil.ImpImporter removed).
# So this container uses Python 3.11, where tensorflow 2.15.x + numpy 1.26.x ships
# prebuilt cp311 wheels and `pip install basic-pitch` "just works".
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# tensorflow needs libgomp
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates libgomp1 \
&& rm -rf /var/lib/apt/lists/*
COPY portal/requirements.txt /tmp/req.txt
RUN pip install --no-cache-dir -r /tmp/req.txt
# Basic Pitch pulls tensorflow-cpu (~large) + librosa + numpy 1.x — all have
# cp311 wheels. basic-pitch imports pkg_resources, which setuptools >=81 removed,
# so pin setuptools<81 to keep it available.
RUN pip install --no-cache-dir --upgrade pip "setuptools<81" wheel \
&& pip install --no-cache-dir basic-pitch tflite-runtime
COPY . /app/
CMD ["celery", "-A", "portal.tasks.celery_app", "worker", "-Q", "transcription", "--concurrency=1", "--loglevel=info"]