pvanand commited on
Commit
05e53e4
·
verified ·
1 Parent(s): 39cfc30

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -24
Dockerfile CHANGED
@@ -1,37 +1,27 @@
1
- # Dockerfile
2
- FROM node:16
3
-
4
- # Install latest chrome dev package and fonts to support major charsets
5
- RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
6
- && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
7
- && apt-get update \
8
- && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
9
- --no-install-recommends \
10
- && rm -rf /var/lib/apt/lists/*
11
 
 
12
  WORKDIR /usr/src/app
13
 
14
- # Add user so we don't need --no-sandbox.
15
- RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
16
- && mkdir -p /home/pptruser/Downloads \
17
- && chown -R pptruser:pptruser /home/pptruser
18
-
19
  # Install app dependencies
 
20
  COPY package*.json ./
 
21
  RUN npm install
22
 
23
  # Bundle app source
24
  COPY . .
25
 
26
- # Set correct permissions
27
- RUN chown -R pptruser:pptruser /usr/src/app
28
-
29
- # Create a directory for temporary files with correct permissions
30
- RUN mkdir -p /tmp/marp-work && chown -R pptruser:pptruser /tmp/marp-work && chmod -R 777 /tmp/marp-work
31
 
32
- # Run everything after as non-privileged user.
33
- USER pptruser
34
 
35
- EXPOSE 7860
 
36
 
37
- CMD ["node", "server.js"]
 
 
1
+ # Use Node.js 16 as the base image
2
+ FROM node:16-slim
 
 
 
 
 
 
 
 
3
 
4
+ # Create app directory
5
  WORKDIR /usr/src/app
6
 
 
 
 
 
 
7
  # Install app dependencies
8
+ # A wildcard is used to ensure both package.json AND package-lock.json are copied
9
  COPY package*.json ./
10
+
11
  RUN npm install
12
 
13
  # Bundle app source
14
  COPY . .
15
 
16
+ # Create a non-root user
17
+ RUN groupadd -r nodeuser && useradd -r -g nodeuser nodeuser \
18
+ && chown -R nodeuser:nodeuser /usr/src/app
 
 
19
 
20
+ # Switch to non-root user
21
+ USER nodeuser
22
 
23
+ # Expose the port the app runs on
24
+ EXPOSE 3000
25
 
26
+ # Start the application
27
+ CMD ["node", "index.js"]