Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +17 -11
Dockerfile
CHANGED
@@ -21,18 +21,20 @@ COPY requirements.txt .
|
|
21 |
|
22 |
# Upgrade pip first and set timeout + retries
|
23 |
RUN pip install --upgrade pip \
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
ENV TRANSFORMERS_CACHE=/models/transformers
|
34 |
-
ENV HF_DATASETS_CACHE=/models/datasets
|
35 |
-
ENV HF_METRICS_CACHE=/models/metrics
|
36 |
|
37 |
# Pre-download the SAM model from Hugging Face
|
38 |
RUN python -c "\
|
@@ -43,8 +45,12 @@ SamProcessor.from_pretrained('Zigeng/SlimSAM-uniform-50')"
|
|
43 |
# Copy all project files
|
44 |
COPY . .
|
45 |
|
|
|
|
|
|
|
|
|
46 |
# Expose port for Flask
|
47 |
EXPOSE 6000
|
48 |
|
49 |
# Run using gunicorn
|
50 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:6000", "app:app"]
|
|
|
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 |
+
# Set environment variables for cache directories with proper permissions
|
29 |
+
ENV HF_HOME=/tmp/hf_cache
|
30 |
+
ENV TRANSFORMERS_CACHE=/tmp/transformers
|
31 |
+
ENV HF_DATASETS_CACHE=/tmp/datasets
|
32 |
+
ENV HF_METRICS_CACHE=/tmp/metrics
|
33 |
+
ENV MPLCONFIGDIR=/tmp/matplotlib
|
34 |
|
35 |
+
# Create cache directories with proper permissions
|
36 |
+
RUN mkdir -p /tmp/hf_cache /tmp/transformers /tmp/datasets /tmp/metrics /tmp/matplotlib \
|
37 |
+
&& chmod -R 777 /tmp/hf_cache /tmp/transformers /tmp/datasets /tmp/metrics /tmp/matplotlib
|
|
|
|
|
|
|
38 |
|
39 |
# Pre-download the SAM model from Hugging Face
|
40 |
RUN python -c "\
|
|
|
45 |
# Copy all project files
|
46 |
COPY . .
|
47 |
|
48 |
+
# Create necessary directories for the app with proper permissions
|
49 |
+
RUN mkdir -p static/uploads static/outputs \
|
50 |
+
&& chmod -R 777 static
|
51 |
+
|
52 |
# Expose port for Flask
|
53 |
EXPOSE 6000
|
54 |
|
55 |
# Run using gunicorn
|
56 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:6000", "app:app"]
|