File size: 876 Bytes
12263fa
 
 
 
 
 
 
 
 
0eef0af
 
 
5f168d6
0eef0af
332efeb
 
 
 
12263fa
 
 
 
 
 
ee0ba57
5f168d6
 
0eef0af
12263fa
 
 
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
FROM python:3.11-slim

WORKDIR /app

# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential git && \
    rm -rf /var/lib/apt/lists/*

# Writable dirs for matplotlib and HF cache
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV HF_HOME=/tmp/hf_cache
ENV TRITON_CACHE_DIR=/tmp/triton_cache

# Stage 1: Install torch first (flash-attn needs it at build time)
RUN pip install --no-cache-dir torch==2.4.1

# Stage 2: Install everything else
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# App code
COPY . .

# Create writable dirs AFTER copy
RUN mkdir -p /app/models /app/outputs /app/logs /app/eval_logs /tmp/matplotlib /tmp/hf_cache /tmp/triton_cache && \
    chmod -R 777 /app/models /app/outputs /app/logs /app/eval_logs /tmp/matplotlib /tmp/hf_cache /tmp/triton_cache /app

EXPOSE 7860

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