mumer119131 commited on
Commit
cca302a
·
1 Parent(s): 8d6c15d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -0
Dockerfile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
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
+
10
+
11
+ # Set home to the user's home directory
12
+ ENV HOME=/home/user \
13
+ PATH=/home/user/.local/bin:$PATH
14
+
15
+ # Set the working directory to the user's home directory
16
+ WORKDIR $HOME/app
17
+ COPY --chown=user . $HOME/app
18
+
19
+
20
+ COPY ./requirements.txt requirements.txt
21
+
22
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
23
+
24
+
25
+ COPY . .
26
+ # Collect static files and run migrations
27
+ RUN python manage.py makemigrations
28
+ RUN python manage.py migrate
29
+
30
+ USER root
31
+ RUN chmod 777 ~/app/*
32
+ USER user
33
+
34
+ EXPOSE 7860 7860
35
+
36
+
37
+ CMD ["python", "manage.py", "runserver", "0.0.0.0:7860"]