brendon-ai commited on
Commit
5a3c9f4
·
verified ·
1 Parent(s): 3b1f63b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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