Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -4
Dockerfile
CHANGED
|
@@ -9,6 +9,18 @@ RUN apt-get update && \
|
|
| 9 |
apt-get clean && \
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Copy requirements and install
|
| 13 |
COPY requirements.txt .
|
| 14 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
@@ -16,11 +28,9 @@ RUN pip3 install --no-cache-dir -r requirements.txt
|
|
| 16 |
# Copy app files
|
| 17 |
COPY app.py .
|
| 18 |
|
| 19 |
-
# Set environment variables for HF
|
| 20 |
-
ENV HF_HOME=/code
|
| 21 |
-
|
| 22 |
# Expose port
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
# Run the application with proper host to expose externally
|
| 26 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
| 9 |
apt-get clean && \
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Create cache directories with proper permissions
|
| 13 |
+
RUN mkdir -p /tmp/transformers_cache && \
|
| 14 |
+
mkdir -p /tmp/hf_home && \
|
| 15 |
+
mkdir -p /tmp/hf_datasets_cache && \
|
| 16 |
+
mkdir -p /tmp/diffusers_cache && \
|
| 17 |
+
chmod -R 777 /tmp
|
| 18 |
+
|
| 19 |
+
# Set environment variables for HF
|
| 20 |
+
ENV HF_HOME=/tmp/hf_home
|
| 21 |
+
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
| 22 |
+
ENV HF_DATASETS_CACHE=/tmp/hf_datasets_cache
|
| 23 |
+
|
| 24 |
# Copy requirements and install
|
| 25 |
COPY requirements.txt .
|
| 26 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
|
|
| 28 |
# Copy app files
|
| 29 |
COPY app.py .
|
| 30 |
|
|
|
|
|
|
|
|
|
|
| 31 |
# Expose port
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
# Run the application with proper host to expose externally
|
| 35 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 36 |
+
|