Write the recipe
A Dockerfile lists the steps to build your image: start from a base image, copy your code, install dependencies, and say which command starts the app.
Dockerfile instructions
FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --omit=dev COPY . . ENV NODE_ENV=production EXPOSE 3000 CMD ["node", "server.js"]
docker build -t name:tag . — the . is the build context: the folder Docker can COPY from.