bardd commited on
Commit
24c59d1
·
verified ·
1 Parent(s): 6d40e21

Update Dockerfile

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