shreyanshknayak commited on
Commit
d484a37
·
verified ·
1 Parent(s): 10a0db1

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12
2
+ ### Set up user with permissions
3
+ # Set up a new user named "user" with user ID 1000
4
+ RUN useradd -m -u 1000 user
5
+
6
+ # Switch to the "user" user
7
+ USER user
8
+
9
+ # Set home to the user's home directory
10
+ ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH
12
+
13
+ # Set the working directory to the user's home directory
14
+ WORKDIR $HOME/app
15
+
16
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
17
+ COPY --chown=user . $HOME/app
18
+
19
+ ### Set up app-specific content
20
+ COPY requirements.txt requirements.txt
21
+ RUN pip3 install -r requirements.txt
22
+
23
+ COPY . .
24
+
25
+ ### Update permissions for the app
26
+ USER root
27
+ RUN chmod 777 ~/app/*
28
+ USER user
29
+
30
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]