28 lines
819 B
Docker
28 lines
819 B
Docker
FROM python:3.8-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PYTHONPATH=/app
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libsndfile1 \
|
|
sox \
|
|
libsox-dev \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN pip install --upgrade pip setuptools wheel \
|
|
&& pip install --index-url https://download.pytorch.org/whl/cpu torch torchaudio
|
|
|
|
COPY voice-dected/requirements.txt /tmp/requirements.txt
|
|
RUN grep -v -E '^[[:space:]]*(torch|torchaudio)[[:space:]]*$' /tmp/requirements.txt > /tmp/requirements-no-torch.txt \
|
|
&& pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /tmp/requirements-no-torch.txt \
|
|
&& rm -rf /root/.cache/pip
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|