Fred808 commited on
Commit
0df6fc8
·
verified ·
1 Parent(s): 52b9383

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +44 -50
Dockerfile CHANGED
@@ -1,51 +1,45 @@
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
- RUN pip install --no-cache-dir \
19
- "numpy<2" \
20
- torch==2.1.2+cpu \
21
- torchvision==0.16.2+cpu \
22
- torchaudio==2.1.2+cpu \
23
- --index-url https://download.pytorch.org/whl/cpu
24
-
25
- # Copy requirements and install with special handling for flash_attn
26
- COPY requirements.txt .
27
- RUN pip install --no-cache-dir \
28
- -r requirements.txt \
29
- --find-links https://download.pytorch.org/whl/cpu \
30
- --extra-index-url https://pypi.org/simple && \
31
- # Install remaining packages that might have been skipped
32
- pip install --no-cache-dir \
33
- accelerate \
34
- transformers==4.36.2 \
35
- timm==0.9.12 \
36
- einops==0.7.0
37
-
38
- # Copy application code
39
- COPY . .
40
-
41
- # Create non-root user
42
- RUN useradd -m -u 1000 user && \
43
- chown -R user:user /app
44
-
45
- USER user
46
-
47
- # Environment variables to suppress warnings
48
- ENV HF_HUB_DISABLE_PROGRESS=1
49
- ENV TF_CPP_MIN_LOG_LEVEL=3
50
-
51
  CMD ["uvicorn", "download_api:app", "--host", "0.0.0.0", "--port", "7860"]
 
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
+ pip install --no-cache-dir \
27
+ accelerate \
28
+ transformers==4.36.2 \
29
+ timm==0.9.12 \
30
+ einops==0.7.0
31
+
32
+ # Copy application code
33
+ COPY . .
34
+
35
+ # Create non-root user
36
+ RUN useradd -m -u 1000 user && \
37
+ chown -R user:user /app
38
+
39
+ USER user
40
+
41
+ # Environment variables to suppress warnings
42
+ ENV HF_HUB_DISABLE_PROGRESS=1
43
+ ENV TF_CPP_MIN_LOG_LEVEL=3
44
+
 
 
 
 
 
 
45
  CMD ["uvicorn", "download_api:app", "--host", "0.0.0.0", "--port", "7860"]