ritz26 commited on
Commit
945111c
·
verified ·
1 Parent(s): d9581e7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -49
Dockerfile CHANGED
@@ -1,49 +1,52 @@
1
- # Use official Python image
2
- FROM python:3.10-slim
3
-
4
- # Disable interactive prompts
5
- ENV DEBIAN_FRONTEND=noninteractive
6
-
7
- # Set working directory
8
- WORKDIR /app
9
-
10
- # Install system dependencies
11
- RUN apt-get update && apt-get install -y \
12
- ffmpeg \
13
- libsm6 \
14
- libxext6 \
15
- git \
16
- curl \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Copy requirements and install Python packages
20
- COPY requirements.txt .
21
-
22
- # Upgrade pip first and set timeout + retries
23
- RUN pip install --upgrade pip \
24
- && pip config set global.timeout 100 \
25
- && pip config set global.retries 10 \
26
- && pip install --no-cache-dir -r requirements.txt
27
-
28
- RUN pip install --no-cache-dir -r requirements.txt
29
-
30
- # Set Hugging Face cache directory
31
- ENV HF_HOME=/models
32
- ENV TRANSFORMERS_CACHE=/models/transformers
33
- ENV HF_DATASETS_CACHE=/models/datasets
34
- ENV HF_METRICS_CACHE=/models/metrics
35
-
36
- # Pre-download the SAM model from Hugging Face
37
- RUN python -c "\
38
- from transformers import SamModel, SamProcessor; \
39
- SamModel.from_pretrained('Zigeng/SlimSAM-uniform-50'); \
40
- SamProcessor.from_pretrained('Zigeng/SlimSAM-uniform-50')"
41
-
42
- # Copy all project files
43
- COPY . .
44
-
45
- # Expose port for Flask
46
- EXPOSE 6000
47
-
48
- # Run using gunicorn
49
- CMD ["gunicorn", "--bind", "0.0.0.0:6000", "app:app"]
 
 
 
 
1
+ # Use official Python image
2
+ FROM python:3.10-slim
3
+
4
+ # Disable interactive prompts
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Set working directory
8
+ WORKDIR /app
9
+
10
+ # Install system dependencies
11
+ RUN apt-get update && apt-get install -y \
12
+ ffmpeg \
13
+ libsm6 \
14
+ libxext6 \
15
+ git \
16
+ curl \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # Copy requirements and install Python packages
20
+ COPY requirements.txt .
21
+
22
+ # Upgrade pip first and set timeout + retries
23
+ RUN pip install --upgrade pip \
24
+ && pip config set global.timeout 100 \
25
+ && pip config set global.retries 10 \
26
+ && pip install --no-cache-dir -r requirements.txt
27
+
28
+ RUN mkdir -p /app/static/uploads /app/static/outputs
29
+
30
+ RUN pip install --no-cache-dir -r requirements.txt
31
+
32
+
33
+ # Set Hugging Face cache directory
34
+ ENV HF_HOME=/models
35
+ ENV TRANSFORMERS_CACHE=/models/transformers
36
+ ENV HF_DATASETS_CACHE=/models/datasets
37
+ ENV HF_METRICS_CACHE=/models/metrics
38
+
39
+ # Pre-download the SAM model from Hugging Face
40
+ RUN python -c "\
41
+ from transformers import SamModel, SamProcessor; \
42
+ SamModel.from_pretrained('Zigeng/SlimSAM-uniform-50'); \
43
+ SamProcessor.from_pretrained('Zigeng/SlimSAM-uniform-50')"
44
+
45
+ # Copy all project files
46
+ COPY . .
47
+
48
+ # Expose port for Flask
49
+ EXPOSE 6000
50
+
51
+ # Run using gunicorn
52
+ CMD ["gunicorn", "--bind", "0.0.0.0:6000", "app:app"]