Dockerfile
# Use an existing image, node:16-alpine in this case as the base image
FROM node:16-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the package.json and package-lock.json files into the container
COPY package*.json ./
# Install all required dependencies
RUN npm install
# Copy all codes into the container
COPY . .
# Expose the port for the Node.js app
EXPOSE 3000
# Run the app when the container starts
CMD ["npm", "start"]