YoBatM commited on
Commit
cabda22
·
verified ·
1 Parent(s): a29ea93

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See https://hub.docker.com/r/nikolaik/python-nodejs
2
+ # https://github.com/nikolaik/docker-python-nodejs
3
+ # Default user is 'pn' with uid 1000, gid 1000
4
+ FROM nikolaik/python-nodejs:python3.10-nodejs18
5
+
6
+ # Install nginx and give permissions to 'pn'
7
+ # See https://www.rockyourcode.com/run-docker-nginx-as-non-root-user/
8
+ USER root
9
+
10
+ RUN apt-get -y update && apt-get -y install nginx
11
+
12
+ RUN mkdir -p /var/cache/nginx \
13
+ /var/log/nginx \
14
+ /var/lib/nginx
15
+ RUN touch /var/run/nginx.pid
16
+
17
+ RUN chown -R pn:pn /var/cache/nginx \
18
+ /var/log/nginx \
19
+ /var/lib/nginx \
20
+ /var/run/nginx.pid
21
+
22
+ # Install dependencies and build app as non-root
23
+ USER pn
24
+ ENV HOME=/home/pn \
25
+ PATH=/home/pn/.local/bin:$PATH
26
+
27
+ RUN mkdir $HOME/app
28
+
29
+ WORKDIR $HOME/app
30
+
31
+ COPY --chown=pn requirements.txt requirements.txt
32
+ RUN pip install --no-cache-dir -r requirements.txt
33
+
34
+ # Copy nginx configuration
35
+ COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
36
+
37
+ COPY --chown=pn . .
38
+
39
+ CMD ["bash", "run.sh"]