Sgridda commited on
Commit
2f0ed7b
·
1 Parent(s): 937b2c0

Fix cache permissions error

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -2
Dockerfile CHANGED
@@ -1,10 +1,14 @@
1
-
2
  # Use the official Python 3.9 slim image
3
  FROM python:3.9-slim
4
 
5
  # Set the working directory inside the container
6
  WORKDIR /code
7
 
 
 
 
 
 
8
  # Copy the requirements file into the container
9
  COPY ./requirements.txt /code/requirements.txt
10
 
@@ -17,4 +21,4 @@ COPY ./main.py /code/main.py
17
  # Command to run the FastAPI server with Uvicorn
18
  # We use --host 0.0.0.0 to make it accessible from outside the container
19
  # and --port 7860 as this is the standard port Hugging Face Spaces expects
20
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  # Use the official Python 3.9 slim image
2
  FROM python:3.9-slim
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /code
6
 
7
+ # Create a directory for the model cache and set the HF_HOME environment variable.
8
+ # This tells the transformers library to download models here instead of the root .cache folder.
9
+ RUN mkdir /code/cache
10
+ ENV HF_HOME /code/cache
11
+
12
  # Copy the requirements file into the container
13
  COPY ./requirements.txt /code/requirements.txt
14
 
 
21
  # Command to run the FastAPI server with Uvicorn
22
  # We use --host 0.0.0.0 to make it accessible from outside the container
23
  # and --port 7860 as this is the standard port Hugging Face Spaces expects
24
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]