slimshadow commited on
Commit
d0fa882
·
verified ·
1 Parent(s): 7c31de0

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -0
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python image from the Docker Hub
2
+ FROM python:3.9
3
+
4
+ # Create a new user with UID 1000
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Switch to the new user
8
+ USER user
9
+
10
+ # Update the PATH environment variable
11
+ ENV PATH="/home/user/.local/bin:$PATH"
12
+
13
+ # Set the working directory to /app
14
+ WORKDIR /app
15
+
16
+ # Copy the requirements.txt file and change the ownership to the user
17
+ COPY --chown=user ./requirements.txt requirements.txt
18
+
19
+ # Install the dependencies from requirements.txt
20
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
21
+
22
+ # Copy the rest of the application code and change the ownership to the user
23
+ COPY --chown=user . /app
24
+
25
+ # Set the command to run the application using Uvicorn
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]