Hammad712 commited on
Commit
44a3c0a
·
verified ·
1 Parent(s): 52f8af2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -10
Dockerfile CHANGED
@@ -1,16 +1,25 @@
1
- FROM python:3.9-slim
 
2
 
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
- # Install dependencies
6
- COPY requirements.txt .
7
- RUN pip install --no-cache-dir -r requirements.txt
8
 
9
- # Copy your application code
10
- COPY . .
11
 
12
- # Expose the port (if needed)
13
- EXPOSE 7060
14
 
15
- # Run the app with Uvicorn
16
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7060"]
 
1
+ # Base image using Python 3.9
2
+ FROM python:3.9
3
 
4
+ # Create a new user to run the app
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+
8
+ # Set environment variables
9
+ ENV PATH="/home/user/.local/bin:$PATH"
10
+
11
+ # Set the working directory
12
  WORKDIR /app
13
 
14
+ # Copy the requirements and install dependencies
15
+ COPY --chown=user ./requirements.txt requirements.txt
16
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
+ # Copy the rest of the application
19
+ COPY --chown=user . /app
20
 
21
+ # Expose port 7860 for the application
22
+ EXPOSE 7860
23
 
24
+ # Command to run the FastAPI app using uvicorn
25
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]