Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -1
Dockerfile
CHANGED
@@ -1,10 +1,27 @@
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
|
|
3 |
WORKDIR /app
|
|
|
|
|
4 |
COPY . /app
|
5 |
|
|
|
6 |
RUN pip install --no-cache-dir -r requirements.txt
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
EXPOSE 7860
|
9 |
|
10 |
-
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the application files to the container
|
8 |
COPY . /app
|
9 |
|
10 |
+
# Install dependencies
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
+
# Set environment variables
|
14 |
+
ENV HF_HOME="/tmp/huggingface"
|
15 |
+
ENV HF_DATASETS_CACHE="/tmp/huggingface/datasets"
|
16 |
+
ENV TRANSFORMERS_CACHE="/tmp/huggingface/transformers"
|
17 |
+
ENV HF_HUB_CACHE="/tmp/huggingface/hub"
|
18 |
+
|
19 |
+
# Ensure cache directories exist and are writable
|
20 |
+
RUN mkdir -p /tmp/huggingface/datasets /tmp/huggingface/transformers /tmp/huggingface/hub
|
21 |
+
RUN chmod -R 777 /tmp/huggingface # Give full permissions
|
22 |
+
|
23 |
+
# Expose the application port
|
24 |
EXPOSE 7860
|
25 |
|
26 |
+
# Start the Flask app with Gunicorn
|
27 |
+
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "app:app"]
|