File size: 1,136 Bytes
f0d7b8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nvidia/cuda:12.5.1-cudnn-runtime-ubuntu24.04

ENV PYTHONDONTWRITEBYTECODE="1" \
    PYTHONUNBUFFERED="1" \
    DEBIAN_FRONTEND="noninteractive"

# Install system dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        python3-pip \
        python-is-python3 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3013
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel

WORKDIR /app/

# Download models during build instead of copying from local
COPY scripts/model_download.bash /tmp/model_download.bash
RUN python3 -m pip install --no-cache-dir huggingface-hub && \
    bash /tmp/model_download.bash && \
    rm /tmp/model_download.bash

# Install CPU requirements
COPY requirements.cpu.txt ./
RUN python3 -m pip install --no-cache-dir -r ./requirements.cpu.txt

# Install GPU PyTorch requirements
COPY requirements.torch.gpu.txt ./
RUN python3 -m pip install --no-cache-dir -r ./requirements.torch.gpu.txt

COPY app ./app
COPY main.py ./

EXPOSE 8000

ENTRYPOINT ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]