nakas commited on
Commit
0808aa3
·
verified ·
1 Parent(s): c0f4d27

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -0
Dockerfile CHANGED
@@ -11,6 +11,16 @@ RUN apt-get update && apt-get install -y \
11
  libgeos-dev \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
 
 
 
 
 
 
 
14
  # Install Python dependencies
15
  RUN pip install --no-cache-dir --upgrade pip
16
 
@@ -50,5 +60,8 @@ ENV GRADIO_SERVER_PORT=7860
50
  # Expose port
51
  EXPOSE 7860
52
 
 
 
 
53
  # Set command
54
  CMD ["python", "app.py"]
 
11
  libgeos-dev \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Create a non-root user
15
+ RUN useradd -m -u 1000 appuser
16
+
17
+ # Create directories and set permissions
18
+ RUN mkdir -p /app/data /app/.config/matplotlib && \
19
+ chown -R appuser:appuser /app
20
+
21
+ # Set environment variable for matplotlib
22
+ ENV MPLCONFIGDIR=/app/.config/matplotlib
23
+
24
  # Install Python dependencies
25
  RUN pip install --no-cache-dir --upgrade pip
26
 
 
60
  # Expose port
61
  EXPOSE 7860
62
 
63
+ # Switch to non-root user
64
+ USER appuser
65
+
66
  # Set command
67
  CMD ["python", "app.py"]