File size: 1,094 Bytes
1857fb3
 
d63774a
 
 
 
 
 
 
 
 
1857fb3
d63774a
 
 
 
 
 
 
 
 
 
 
 
 
1857fb3
 
 
d63774a
 
 
 
 
 
1857fb3
 
 
d63774a
 
 
1857fb3
d63774a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    TOKENIZERS_PARALLELISM=false \
    HF_HOME=/data/.huggingface \
    HUGGINGFACE_HUB_CACHE=/data/.huggingface/hub \
    TRANSFORMERS_CACHE=/data/.huggingface/transformers \
    WEB_PRELOAD_MODELS=1

RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 \
    python3-pip \
    python3-dev \
    build-essential \
    git \
    curl \
    ca-certificates \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt /app/requirements.txt

RUN python3 -m pip install --upgrade pip setuptools wheel && \
    python3 -m pip install --index-url https://download.pytorch.org/whl/cu121 \
        torch torchvision torchaudio && \
    python3 -m pip install -r requirements.txt

COPY . /app

RUN mkdir -p /data/.huggingface

EXPOSE 7860

CMD ["python3", "-m", "uvicorn", "web.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]