Archimedis commited on
Commit
feebbe2
·
verified ·
1 Parent(s): f2444be

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -10
Dockerfile CHANGED
@@ -1,30 +1,29 @@
1
- # Use Python 3.10 to ensure compatibility
2
  FROM python:3.10
3
 
4
-
5
  WORKDIR /app
6
 
7
-
8
  RUN apt-get update && apt-get install -y ffmpeg libsndfile1
9
 
10
-
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
-
15
- RUN mkdir -p static
16
-
17
 
 
18
  COPY . .
19
 
 
 
20
 
21
- RUN useradd -m -u 1000 user
22
  USER user
 
23
  ENV HOME=/home/user \
24
  PATH=/home/user/.local/bin:$PATH
25
 
26
-
27
  EXPOSE 7860
28
 
29
-
30
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10
2
 
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y ffmpeg libsndfile1
7
 
8
+ # Install Python dependencies
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
+ # Create a non-root user
13
+ RUN useradd -m -u 1000 user
 
14
 
15
+ # Copy application code
16
  COPY . .
17
 
18
+ # CRITICAL FIX: Create static directory and grant ownership to the non-root user
19
+ RUN mkdir -p static && chown -R user:user /app/static && chown -R user:user /app
20
 
21
+ # Switch to the non-root user
22
  USER user
23
+
24
  ENV HOME=/home/user \
25
  PATH=/home/user/.local/bin:$PATH
26
 
 
27
  EXPOSE 7860
28
 
 
29
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]