Containerize Node Application
# Use Node.js 20 Alpine as the base image for building
FROM node:20-alpine AS build
# Set the working directory
WORKDIR /usr/src/app
# Copy the application files into the container
COPY . /usr/src/app
# Install dependencies
RUN npm install
# Build the application
RUN npm run build
# to start the application
CMD ["npm", "start"]Last updated