|
|
|
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
ENV TZ=Europe/London |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
python3 \ |
|
python3-pip \ |
|
python3-distutils \ |
|
ffmpeg \ |
|
tzdata \ |
|
&& ln -fs /usr/share/zoneinfo/$TZ /etc/localtime \ |
|
&& dpkg-reconfigure --frontend noninteractive tzdata \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
USER user |
|
ENV PATH="/home/user/.local/bin:$PATH" |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel |
|
|
|
|
|
RUN pip3 install --no-cache-dir torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121 |
|
|
|
|
|
COPY --chown=user requirements.txt . |
|
RUN pip3 install --no-cache-dir -r requirements.txt |
|
|
|
|
|
RUN python3 -m spacy download zh_core_web_md |
|
|
|
|
|
COPY --chown=user . /app |
|
|
|
|
|
|
|
ENV PORT=7860 |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["python3", "app.py"] |