iyadalagha commited on
Commit
e82d391
·
1 Parent(s): e54458e

Fix permissions error

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -2
Dockerfile CHANGED
@@ -4,12 +4,19 @@ FROM python:3.9
4
  # Set working directory in the container
5
  WORKDIR /app
6
 
 
 
 
 
 
 
 
7
  # Copy requirements.txt and install dependencies
8
- COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
  # Copy the application code
12
- COPY . .
13
 
14
  # Run the FastAPI app with Uvicorn
15
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
4
  # Set working directory in the container
5
  WORKDIR /app
6
 
7
+ # Create a non-root user and set permissions
8
+ RUN useradd -m myuser && chown -R myuser:myuser /app
9
+ USER myuser
10
+
11
+ # Set Hugging Face cache directory
12
+ ENV HF_HOME=/app/.cache/huggingface
13
+
14
  # Copy requirements.txt and install dependencies
15
+ COPY --chown=myuser:myuser requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
  # Copy the application code
19
+ COPY --chown=myuser:myuser . .
20
 
21
  # Run the FastAPI app with Uvicorn
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]