File size: 1,097 Bytes
81da345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647f69c
81da345
 
 
 
 
 
 
 
647f69c
81da345
 
 
 
 
 
 
 
 
 
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
# Modern NVIDIA base image with CUDA 12.9 and Ubuntu 24.04 LTS
FROM nvidia/cuda:12.9.1-runtime-ubuntu24.04

# Avoid interactive errors
ENV DEBIAN_FRONTEND=noninteractive

# System packages
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    git \
    && rm -rf /var/lib/apt/lists/*

# Make python3 the default python
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

# Working directory
WORKDIR /app

# Copy requirements first (to enable Docker cache)
COPY docker/requirements.txt /app/requirements.txt

# Install PyTorch with CUDA support first (separate to use correct index URL)
RUN pip install --no-cache-dir torch==2.9.1 --index-url https://download.pytorch.org/whl/cu129 --break-system-packages

# Install remaining dependencies
RUN pip install --no-cache-dir -r requirements.txt --break-system-packages

# Copy application code
COPY src/app.py /app/app.py
COPY model /app/model

# Uvicorn exposed port
EXPOSE 7860

# Optimize Python for container
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_NO_ADVISORY_WARNINGS=1

CMD ["python", "app.py"]