Rohan014 commited on
Commit
9c93268
·
verified ·
1 Parent(s): b776be2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -3
Dockerfile CHANGED
@@ -1,20 +1,26 @@
1
  FROM python:3.11-slim
2
 
3
  # Create user with UID 1000
4
- RUN useradd -u 1000 -m user
5
 
6
  WORKDIR /app
7
 
 
8
  COPY requirements.txt .
 
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
 
11
  COPY . .
12
 
 
 
 
13
  ENV APP_PORT=7152
14
 
15
  EXPOSE 7152
16
 
17
- # Switch to UID 1000 explicitly
18
  USER 1000
19
 
20
- CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${APP_PORT}"]
 
1
  FROM python:3.11-slim
2
 
3
  # Create user with UID 1000
4
+ RUN useradd -m -u 1000 user
5
 
6
  WORKDIR /app
7
 
8
+ # Copy requirements first
9
  COPY requirements.txt .
10
+
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy rest of app
14
  COPY . .
15
 
16
+ # Change ownership of app folder
17
+ RUN chown -R 1000:1000 /app
18
+
19
  ENV APP_PORT=7152
20
 
21
  EXPOSE 7152
22
 
23
+ # Switch to non-root user
24
  USER 1000
25
 
26
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7152"]