forked from haicker-app/demo-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (19 loc) · 666 Bytes
/
Copy pathDockerfile
File metadata and controls
26 lines (19 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Use a more compatible Node.js runtime as the base image
FROM node:18-slim
# The node image includes a non-root "node" user we'll use for security.
# Set the working directory.
WORKDIR /usr/src/app
# Copy package files and install dependencies.
# This is done in a separate step to leverage Docker's layer cache.
COPY package*.json ./
RUN npm install
# Copy the rest of the application code.
COPY . .
# Change ownership of the app directory to the "node" user.
RUN chown -R node:node /usr/src/app
# Switch to the non-root "node" user.
USER node
# Expose the port the app runs on.
EXPOSE 3000
# Define the command to run the application.
CMD ["npm", "start"]