euler314 commited on
Commit
e7651f1
·
verified ·
1 Parent(s): 711255c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -3
Dockerfile CHANGED
@@ -14,6 +14,17 @@ RUN apt-get update && apt-get install -y \
14
  git \
15
  && rm -rf /var/lib/apt/lists/*
16
 
 
 
 
 
 
 
 
 
 
 
 
17
  # Copy requirements file
18
  COPY requirements.txt .
19
 
@@ -23,15 +34,19 @@ RUN pip install --no-cache-dir -r requirements.txt
23
  # Copy application code
24
  COPY . .
25
 
26
- # Create data directory
27
- RUN mkdir -p /code/data
28
-
29
  # Set environment variables
30
  ENV DATA_PATH=/code/data
31
 
32
  # Expose port
33
  EXPOSE 7860
34
 
 
 
 
 
 
 
 
35
  # Create entrypoint script
36
  RUN echo '#!/bin/bash\n\
37
  python app.py --data_path=/code/data' > /code/entrypoint.sh && \
 
14
  git \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Create data directory and set permissions
18
+ RUN mkdir -p /code/data && \
19
+ chmod 777 /code/data
20
+
21
+ # Create matplotlib config directory and set permissions
22
+ RUN mkdir -p /tmp/matplotlib && \
23
+ chmod 777 /tmp/matplotlib
24
+
25
+ # Set matplotlib config directory
26
+ ENV MPLCONFIGDIR=/tmp/matplotlib
27
+
28
  # Copy requirements file
29
  COPY requirements.txt .
30
 
 
34
  # Copy application code
35
  COPY . .
36
 
 
 
 
37
  # Set environment variables
38
  ENV DATA_PATH=/code/data
39
 
40
  # Expose port
41
  EXPOSE 7860
42
 
43
+ # Create non-root user
44
+ RUN useradd -m -u 1000 appuser && \
45
+ chown -R appuser:appuser /code
46
+
47
+ # Switch to non-root user
48
+ USER appuser
49
+
50
  # Create entrypoint script
51
  RUN echo '#!/bin/bash\n\
52
  python app.py --data_path=/code/data' > /code/entrypoint.sh && \