Update Dockerfile
Browse files- 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 |
-
#
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
COPY package*.json ./
|
|
|
9 |
|
10 |
-
#
|
11 |
COPY . .
|
12 |
|
13 |
-
#
|
14 |
-
RUN
|
|
|
|
|
|
|
15 |
|
16 |
-
# Expose the port
|
17 |
EXPOSE 7860
|
18 |
|
19 |
-
# Command to run
|
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"]
|