bardd commited on
Commit
eca71ed
·
verified ·
1 Parent(s): e890588

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -12
Dockerfile CHANGED
@@ -1,25 +1,25 @@
1
  FROM node:20-alpine
2
 
3
- # Create app directory
4
  WORKDIR /app
5
 
6
- RUN npm install -g --unsafe-perm=true --allow-root
7
-
8
- # Install app dependencies
9
  COPY package*.json ./
 
 
10
  RUN npm install
11
 
12
- # Bundle app source
13
  COPY . .
14
 
15
- # Create a non-root user and switch to it
16
- RUN addgroup -g 1001 -S nodejs
17
- RUN adduser -S nestjs -u 1001
18
- RUN chown -R nestjs:nodejs /app
19
- USER nestjs
20
 
21
- # Expose the port the app runs on
22
  EXPOSE 7860
23
 
24
- # Command to run the application
25
  CMD ["npm", "run", "start:dev"]
 
1
  FROM node:20-alpine
2
 
3
+ # Set working directory
4
  WORKDIR /app
5
 
6
+ # Copy package.json and package-lock.json
 
 
7
  COPY package*.json ./
8
+
9
+ # Install dependencies
10
  RUN npm install
11
 
12
+ # Copy the rest of your application code
13
  COPY . .
14
 
15
+ # Change ownership of the /app directory to the node user
16
+ RUN chown -R node:node /app
17
+
18
+ # Switch to the node user
19
+ USER node
20
 
21
+ # Expose the port your app runs on
22
  EXPOSE 7860
23
 
24
+ # Command to run your app in development mode
25
  CMD ["npm", "run", "start:dev"]