Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -1
Dockerfile
CHANGED
@@ -9,13 +9,19 @@ WORKDIR /app
|
|
9 |
RUN python -m venv /opt/venv
|
10 |
ENV PATH="/opt/venv/bin:$PATH"
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# Install dependencies from requirements.txt into the virtual environment
|
13 |
COPY requirements.txt .
|
14 |
RUN pip install --no-cache-dir -r requirements.txt
|
15 |
|
16 |
# Copy your application code
|
17 |
COPY app.py .
|
18 |
-
|
19 |
# Expose the port your API will run on
|
20 |
# Hugging Face Spaces typically uses port 8000 for custom Docker builds
|
21 |
EXPOSE 8000
|
|
|
9 |
RUN python -m venv /opt/venv
|
10 |
ENV PATH="/opt/venv/bin:$PATH"
|
11 |
|
12 |
+
# Create a dedicated directory for Hugging Face cache and ensure permissions.
|
13 |
+
# This prevents 'PermissionError' issues when downloading models by directing
|
14 |
+
# Hugging Face to a location with guaranteed write access.
|
15 |
+
ENV HF_HOME=/app/.hf_cache
|
16 |
+
RUN mkdir -p ${HF_HOME} && chmod -R 777 ${HF_HOME}
|
17 |
+
|
18 |
# Install dependencies from requirements.txt into the virtual environment
|
19 |
COPY requirements.txt .
|
20 |
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
|
22 |
# Copy your application code
|
23 |
COPY app.py .
|
24 |
+
å
|
25 |
# Expose the port your API will run on
|
26 |
# Hugging Face Spaces typically uses port 8000 for custom Docker builds
|
27 |
EXPOSE 8000
|