abdullahalioo commited on
Commit
1cfc7c9
·
verified ·
1 Parent(s): d6bb550

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -14
Dockerfile CHANGED
@@ -1,8 +1,3 @@
1
- fastapi
2
- uvicorn
3
- websockets
4
- python-multipart
5
-
6
  FROM python:3.10-slim
7
 
8
  # Set working directory
@@ -15,10 +10,8 @@ RUN apt-get update && \
15
  git \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
-
19
-
20
- # Set environment variables
21
-
22
 
23
  # Copy requirements first
24
  COPY requirements.txt .
@@ -27,14 +20,14 @@ COPY requirements.txt .
27
  RUN pip install --upgrade pip && \
28
  pip install --no-cache-dir -r requirements.txt
29
 
30
- # Copy application code
31
  COPY . .
32
 
33
-
34
  USER myuser
35
 
36
- # Expose port
37
  EXPOSE 7860
38
 
39
- # Run the app
40
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
1
  FROM python:3.10-slim
2
 
3
  # Set working directory
 
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Optional: Create a non-root user
14
+ RUN useradd -ms /bin/bash myuser
 
 
15
 
16
  # Copy requirements first
17
  COPY requirements.txt .
 
20
  RUN pip install --upgrade pip && \
21
  pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy the rest of the app
24
  COPY . .
25
 
26
+ # Switch to non-root user
27
  USER myuser
28
 
29
+ # Expose port Flask will run on
30
  EXPOSE 7860
31
 
32
+ # Run the Flask app
33
+ CMD ["python", "main.py"]