Nick Starkov commited on
Commit
45a2bd8
·
1 Parent(s): 0c6ce54

Dockerfile cache bug fix

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -1
Dockerfile CHANGED
@@ -4,8 +4,13 @@ FROM python:3.10-slim
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Set Hugging Face cache directory to a writable location
8
  ENV HF_HOME=/app/.cache
 
 
 
 
 
9
 
10
  # Copy the requirements file to install dependencies
11
  COPY requirements.txt .
@@ -16,6 +21,10 @@ RUN pip install --no-cache-dir -r requirements.txt
16
  # Copy the application code
17
  COPY app.py .
18
 
 
 
 
 
19
  # Expose the port Flask will run on
20
  EXPOSE 8000
21
 
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Set Hugging Face cache directories to a writable location
8
  ENV HF_HOME=/app/.cache
9
+ ENV HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface
10
+
11
+ # Create cache directory and set permissions
12
+ RUN mkdir -p /app/.cache/huggingface && \
13
+ chmod -R 777 /app/.cache
14
 
15
  # Copy the requirements file to install dependencies
16
  COPY requirements.txt .
 
21
  # Copy the application code
22
  COPY app.py .
23
 
24
+ # Create a non-root user and switch to it
25
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
26
+ USER appuser
27
+
28
  # Expose the port Flask will run on
29
  EXPOSE 8000
30