shubham5524 commited on
Commit
f212e36
·
verified ·
1 Parent(s): 8c5f69e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -1
Dockerfile CHANGED
@@ -14,12 +14,23 @@ RUN apt-get update && apt-get install -y \
14
  # Set working directory
15
  WORKDIR /app
16
 
 
 
 
 
 
 
 
 
17
  # Copy project files
18
- COPY . .
19
 
20
  # Install Python dependencies
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
 
 
 
23
  # Expose the port used by FastAPI
24
  EXPOSE 7860
25
 
 
14
  # Set working directory
15
  WORKDIR /app
16
 
17
+ # Create a non-root user to run the application
18
+ RUN useradd -m appuser
19
+ RUN chown -R appuser:appuser /app
20
+
21
+ # Create cache directories with proper permissions
22
+ RUN mkdir -p /tmp/matplotlib /tmp/torchxrayvision
23
+ RUN chown -R appuser:appuser /tmp/matplotlib /tmp/torchxrayvision
24
+
25
  # Copy project files
26
+ COPY --chown=appuser:appuser . .
27
 
28
  # Install Python dependencies
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ # Switch to non-root user
32
+ USER appuser
33
+
34
  # Expose the port used by FastAPI
35
  EXPOSE 7860
36