yasserrmd commited on
Commit
646309f
·
verified ·
1 Parent(s): 0d2b37c

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.11 as the base image
2
+ FROM python:3.11
3
+
4
+ # Create a non-root user
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Switch to the non-root user
8
+ USER user
9
+
10
+ # Set the environment PATH to include user's local bin
11
+ ENV PATH="/home/user/.local/bin:$PATH"
12
+
13
+ # Set the working directory
14
+ WORKDIR /app
15
+
16
+ # Copy the requirements file and install dependencies
17
+ COPY --chown=user ./requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
+
20
+ # Copy the application files to the working directory
21
+ COPY --chown=user . /app
22
+
23
+ # Expose the port that the application will run on
24
+ EXPOSE 7860
25
+
26
+ # Start the FastAPI application using uvicorn
27
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]