File size: 1,172 Bytes
c8a837a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV HF_HOME=/app/model_cache
ENV HF_HUB_CACHE=/app/model_cache/hub
ENV TORCH_HOME=/app/model_cache/torch
WORKDIR /app

# Sistema e toolchain
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3.10 python3.10-dev python3.10-distutils python3-pip \
    git wget curl ffmpeg libglib2.0-0 libsm6 libxext6 libxrender-dev \
    libgomp1 build-essential ninja-build cmake \
 && rm -rf /var/lib/apt/lists/*

RUN ln -sf /usr/bin/python3.10 /usr/bin/python3 && \
    ln -sf /usr/bin/python3.10 /usr/bin/python && \
    python3 -m pip install --upgrade pip

# PyTorch 2.6.0 + cu124
RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 \
      torch==2.6.0 torchvision torchaudio

# Dependências Python base do app (sem FA/Apex aqui)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
 && pip install --no-cache-dir "tiktoken>=0.7,<0.9"

# Copiar app e start
COPY . .
RUN chmod +x ./start.sh

# Usuário não-root
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
ENV PORT=7860
CMD ["./start.sh"]