declare_study / Dockerfile
raianand's picture
Update Dockerfile
4c98b4c verified
Raw
History Blame Contribute Delete
1.27 kB
FROM python:3.10-slim
# ffmpeg is required at runtime: the browser records audio in whatever codec
# MediaRecorder produces (typically webm/opus), and app.py shells out to
# ffmpeg to convert it to 16kHz mono WAV before ASR inference.
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libsndfile1 \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV PORT=7860
# Same fix applied in the training/probing notebooks earlier in this project:
# a broken numba-cuda shim can crash `import nemo.collections.asr` with an
# unrelated "numba.cuda.types has no attribute NPDatetime" error. NeMo doesn't
# need numba's CUDA-JIT target for inference (GPU tensor ops go through
# PyTorch/CUDA directly), so disabling it here is a safe, cheap guard against
# that entire class of failure inside the container too.
ENV NUMBA_DISABLE_CUDA=1
EXPOSE 7860
RUN mkdir -p /app/results && chmod -R 777 /app/results
# Single worker: app.py keeps session state in an in-memory dict (see its
# docstring). Do not scale this to multiple gunicorn workers without first
# moving session state to a shared store (Redis, a database, etc).
CMD ["python", "app.py"]