pvanand commited on
Commit
7630caf
1 Parent(s): 68394ea

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -4
Dockerfile CHANGED
@@ -10,10 +10,19 @@ COPY . /app
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # RUN chmod -R a+w /usr/local/lib/python3.10/site-packages/hrequests/bin/
 
14
 
15
- # # Run the script to download NLTK data
16
- # RUN python /app/download_nltk_data.py
 
 
 
 
 
 
 
 
17
 
18
  # Start the FastAPI app on port 7860, the default port expected by Spaces
19
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Create a non-root user
14
+ RUN useradd -m appuser
15
 
16
+ # Create necessary directories and set permissions
17
+ RUN mkdir -p /app/data && \
18
+ chown -R appuser:appuser /app && \
19
+ chmod -R 755 /app && \
20
+ mkdir -p /tmp/app-work && \
21
+ chown -R appuser:appuser /tmp/app-work && \
22
+ chmod -R 777 /tmp/app-work
23
+
24
+ # Switch to the non-root user
25
+ USER appuser
26
 
27
  # Start the FastAPI app on port 7860, the default port expected by Spaces
28
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]