multimodalart HF Staff commited on
Commit
a0a7d0f
·
1 Parent(s): d7867e2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -6,24 +6,29 @@ RUN npm install -g pm2 \
6
  && apt-get update \
7
  && apt-get install -y nginx
8
 
9
- # Set working directory
 
 
 
 
 
10
  WORKDIR /app
11
 
12
  # Copy package.json and package-lock.json
13
- COPY package*.json ./
14
 
15
  # Install dependencies
16
  RUN npm install
17
 
18
  # Copy app.js and generate-config.js
19
- COPY app.js .
20
- COPY generate-config.js .
21
 
22
  # Copy NGINX main config file
23
- COPY nginx.conf /etc/nginx/
24
 
25
  # Generate config files and start the applications at runtime
26
  CMD ["sh", "-c", "node generate-config.js && cp default.conf /etc/nginx/conf.d/ && pm2 start ecosystem.config.js && nginx -g 'daemon off;'"]
27
 
28
  # Expose ports
29
- EXPOSE 7860
 
6
  && apt-get update \
7
  && apt-get install -y nginx
8
 
9
+ # Set working directory and set permissions
10
+ RUN mkdir -p /app && chown -R node:node /app
11
+
12
+ # Change the user from root to node
13
+ USER node
14
+
15
  WORKDIR /app
16
 
17
  # Copy package.json and package-lock.json
18
+ COPY --chown=node:node package*.json ./
19
 
20
  # Install dependencies
21
  RUN npm install
22
 
23
  # Copy app.js and generate-config.js
24
+ COPY --chown=node:node app.js .
25
+ COPY --chown=node:node generate-config.js .
26
 
27
  # Copy NGINX main config file
28
+ COPY --chown=node:node nginx.conf /etc/nginx/
29
 
30
  # Generate config files and start the applications at runtime
31
  CMD ["sh", "-c", "node generate-config.js && cp default.conf /etc/nginx/conf.d/ && pm2 start ecosystem.config.js && nginx -g 'daemon off;'"]
32
 
33
  # Expose ports
34
+ EXPOSE 7860