Ezmary commited on
Commit
03c6e78
·
verified ·
1 Parent(s): 56a75e2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -9
Dockerfile CHANGED
@@ -5,23 +5,25 @@ FROM python:3.9-slim
5
  # Set the working directory in the container
6
  WORKDIR /app
7
 
8
- # --- START OF FINAL FIX ---
9
- # 1. Set the environment variable for the cache location
10
  ENV HF_HOME=/app/cache
11
 
12
- # 2. Create the cache directory AND give it full write permissions during the build process
13
- RUN mkdir -p /app/cache && chmod -R 777 /app/cache
14
- # --- END OF FINAL FIX ---
15
-
16
- # Copy the requirements file into the container at /app
17
  COPY requirements.txt .
18
 
19
- # Install any needed packages specified in requirements.txt
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
- # Copy the rest of the application's code (including templates folder)
23
  COPY . .
24
 
 
 
 
 
 
 
 
25
  # Expose the port the app runs on
26
  EXPOSE 7860
27
 
 
5
  # Set the working directory in the container
6
  WORKDIR /app
7
 
8
+ # Set the environment variable to tell huggingface_hub to use a writable directory
 
9
  ENV HF_HOME=/app/cache
10
 
11
+ # Copy requirements first for better caching
 
 
 
 
12
  COPY requirements.txt .
13
 
14
+ # Install dependencies
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy the rest of the application's code
18
  COPY . .
19
 
20
+ # --- START OF FINAL FIX ---
21
+ # Grant full write permissions to the entire application directory.
22
+ # This allows the app to create temporary files (like 'temp_usage_data.json')
23
+ # and also allows huggingface_hub to create its cache directory.
24
+ RUN chmod -R 777 /app
25
+ # --- END OF FINAL FIX ---
26
+
27
  # Expose the port the app runs on
28
  EXPOSE 7860
29