awacke1 commited on
Commit
034926d
·
verified ·
1 Parent(s): ae20c00

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -5
Dockerfile CHANGED
@@ -1,19 +1,22 @@
1
  FROM python:3.11-slim
2
 
3
- # Install curl for healthcheck (minimal dependency)
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  curl \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
- # Set working directory
9
- WORKDIR /home/user/app
 
 
10
 
11
- # Create non-root user
12
- RUN useradd -m -u 1000 user
13
  USER user
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
 
 
 
 
17
  # Copy requirements first to leverage Docker cache
18
  COPY --chown=user requirements.txt .
19
 
@@ -23,6 +26,9 @@ RUN pip install --no-cache-dir -r requirements.txt
23
  # Copy app files
24
  COPY --chown=user app.py presidio_helpers.py .
25
 
 
 
 
26
  # Expose Streamlit port
27
  EXPOSE 7860
28
 
 
1
  FROM python:3.11-slim
2
 
3
+ # Install curl for healthcheck
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  curl \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
+ # Create non-root user and set up directories with correct permissions
9
+ RUN useradd -m -u 1000 user \
10
+ && mkdir -p /home/user/.local /home/user/app \
11
+ && chown -R user:user /home/user
12
 
 
 
13
  USER user
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
 
17
+ # Set working directory
18
+ WORKDIR /home/user/app
19
+
20
  # Copy requirements first to leverage Docker cache
21
  COPY --chown=user requirements.txt .
22
 
 
26
  # Copy app files
27
  COPY --chown=user app.py presidio_helpers.py .
28
 
29
+ # Ensure working directory is writable
30
+ RUN chmod -R u+rw /home/user/app
31
+
32
  # Expose Streamlit port
33
  EXPOSE 7860
34