|
|
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 |
|
|
LABEL maintainer="Hugging Face" |
|
|
|
|
|
ENV PYTHONUNBUFFERED 1 |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive |
|
|
|
|
|
|
|
|
SHELL ["sh", "-lc"] |
|
|
|
|
|
RUN apt update |
|
|
|
|
|
RUN apt --yes install curl |
|
|
|
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - |
|
|
|
|
|
RUN apt --yes install nodejs |
|
|
|
|
|
RUN apt --yes install git git-lfs libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg |
|
|
|
|
|
RUN git lfs install |
|
|
|
|
|
RUN python3 -m pip install --no-cache-dir --upgrade pip |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
|
USER user |
|
|
ENV HOME=/home/user \ |
|
|
PATH=/home/user/.local/bin:$PATH |
|
|
|
|
|
WORKDIR $HOME/app |
|
|
|
|
|
|
|
|
COPY --chown=user package*.json . |
|
|
|
|
|
RUN npm install |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG PYTORCH='2.0.1' |
|
|
ARG TORCH_VISION='' |
|
|
ARG TORCH_AUDIO='' |
|
|
|
|
|
ARG CUDA='cu118' |
|
|
|
|
|
RUN [ ${#PYTORCH} -gt 0 ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA |
|
|
RUN [ ${#TORCH_VISION} -gt 0 ] && VERSION='torchvision=='TORCH_VISION'.*' || VERSION='torchvision'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA |
|
|
RUN [ ${#TORCH_AUDIO} -gt 0 ] && VERSION='torchaudio=='TORCH_AUDIO'.*' || VERSION='torchaudio'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
COPY requirements.txt ./ |
|
|
RUN pip install -r requirements.txt |
|
|
|
|
|
COPY --chown=user . . |
|
|
|
|
|
|
|
|
ENV PYTHON_BIN /usr/bin/python3 |
|
|
|
|
|
RUN python3 download-model.py |
|
|
|
|
|
|
|
|
CMD [ "npm", "run", "test" ] |