Rox-Turbo commited on
Commit
2694bf0
·
verified ·
1 Parent(s): c1c870d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -9
Dockerfile CHANGED
@@ -5,20 +5,17 @@ WORKDIR /app
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1
7
 
8
- # Install dependencies first (better caching)
 
 
 
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
- # Create user first
13
- RUN useradd -m -u 1000 user
14
-
15
- # Copy application code
16
  COPY --chown=user:user . .
17
 
18
- # Make startup script executable (if it exists)
19
- RUN if [ -f start.sh ]; then chmod +x start.sh; fi
20
-
21
- # Switch to user
22
  USER user
23
 
24
  # Set PATH for user
 
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1
7
 
8
+ # Create user first (before any file operations)
9
+ RUN useradd -m -u 1000 user
10
+
11
+ # Install dependencies as root
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
+ # Copy application code and set ownership in one step
 
 
 
16
  COPY --chown=user:user . .
17
 
18
+ # Switch to non-root user
 
 
 
19
  USER user
20
 
21
  # Set PATH for user