Ahmad Schinner commited on
Commit
71ea33c
·
verified ·
1 Parent(s): 0346088

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -10
Dockerfile CHANGED
@@ -1,15 +1,27 @@
1
- FROM docker.io/library/node:18-alpine@sha256:02376a266c84acbf45bd19440e08e48b1c8b98037417334046029ab585de03e2
 
2
 
3
- # Install dependencies
4
- RUN npm cache clean --force
5
- RUN rm -rf /root/.npm/_locks/idealTree* # Remove potential locks
6
- RUN npm install express axios cheerio
7
 
8
- # Copy your application code
9
- COPY index.js .
 
10
 
11
- # Expose port 7860
 
 
 
 
 
 
 
 
 
 
 
 
12
  EXPOSE 3000 7860
13
 
14
- # Run your application
15
- CMD ["node", "index.js"]
 
1
+ # Node base image
2
+ FROM node:16
3
 
4
+ # Switch to the "node" user
5
+ USER node
 
 
6
 
7
+ # Set home to the user's home directory
8
+ ENV HOME=/home/node \
9
+ PATH=/home/node/.local/bin:$PATH
10
 
11
+ # Set the working directory to the user's home directory
12
+ WORKDIR $HOME/app
13
+
14
+ # Moving file to user's home directory
15
+ ADD . $HOME/app
16
+
17
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
18
+ COPY --chown=node . $HOME/app
19
+
20
+ # Loading Dependencies
21
+ RUN npm install
22
+
23
+ # Expose application's default port
24
  EXPOSE 3000 7860
25
 
26
+ # Entry Point
27
+ ENTRYPOINT ["nodejs", "./index.js"]