faisalshah012003 commited on
Commit
9da31b6
·
verified ·
1 Parent(s): 3c4b385

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -27
Dockerfile CHANGED
@@ -1,36 +1,15 @@
1
- # Build stage
2
- FROM python:3.10 AS builder
3
- WORKDIR /app
4
-
5
- # Set up cache directories
6
- RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
7
- ENV HF_HOME=/tmp/huggingface_cache
8
- ENV TRANSFORMERS_CACHE=/tmp/huggingface_cache
9
-
10
- # Copy requirements and install
11
- COPY requirements.txt .
12
- RUN pip install -r requirements.txt
13
-
14
- # Pre-download models
15
- COPY download_models.py .
16
- RUN python download_models.py
17
-
18
- # Runtime stage
19
  FROM python:3.10-slim
20
- WORKDIR /app
21
 
22
- # Set up cache directories in runtime stage
23
- RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
24
- ENV HF_HOME=/tmp/huggingface_cache
25
- ENV TRANSFORMERS_CACHE=/tmp/huggingface_cache
26
 
27
- # Copy everything from builder
28
- COPY --from=builder /usr/local/lib/python3.10 /usr/local/lib/python3.10
29
- COPY --from=builder /usr/local/bin /usr/local/bin
30
- COPY --from=builder /tmp/huggingface_cache /tmp/huggingface_cache
31
 
32
  # Copy application code
33
  COPY . .
34
 
35
  EXPOSE 50010
 
36
  CMD ["python3", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM python:3.10-slim
 
2
 
3
+ WORKDIR /app
 
 
 
4
 
5
+ # Install build dependencies (if any are needed by pip packages)
6
+ # Remove build dependencies afterward if minimizing size is critical
7
+ COPY requirements.txt .
8
+ RUN pip install --no-cache-dir -r requirements.txt
9
 
10
  # Copy application code
11
  COPY . .
12
 
13
  EXPOSE 50010
14
+
15
  CMD ["python3", "app.py"]