Fred808 commited on
Commit
430cf69
·
verified ·
1 Parent(s): baa75e2

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim-bullseye
2
+
3
+ # Install system dependencies
4
+ RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list && \
5
+ apt-get update && \
6
+ apt-get install -y --no-install-recommends \
7
+ unrar \
8
+ libgl1 \
9
+ libglib2.0-0 \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ WORKDIR /app
13
+
14
+ # Upgrade pip and install core dependencies first
15
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel packaging
16
+
17
+ # Install CPU-only PyTorch first
18
+
19
+ # Copy requirements and install with special handling for flash_attn
20
+ COPY requirements.txt .
21
+ RUN pip install --no-cache-dir \
22
+ -r requirements.txt \
23
+ --find-links https://download.pytorch.org/whl/cpu \
24
+ --extra-index-url https://pypi.org/simple && \
25
+ # Install remaining packages that might have been skipped
26
+
27
+ # Copy application code
28
+ COPY . .
29
+
30
+ # Create non-root user
31
+ RUN useradd -m -u 1000 user && \
32
+ chown -R user:user /app
33
+
34
+ USER user
35
+
36
+ # Environment variables to suppress warnings
37
+ ENV HF_HUB_DISABLE_PROGRESS=1
38
+ ENV TF_CPP_MIN_LOG_LEVEL=3
39
+
40
+ CMD ["uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "7860"]