Cheatsheet Pages / Docker Cheatsheet
The Dockerfile instructions that matter — FROM, WORKDIR, COPY, RUN, EXPOSE, CMD
You are writing a Dockerfile and want the essential instructions in the order they are usually layered.
FROM node:22-alpine # base image — always pin a version
WORKDIR /app # following paths are relative to /app
COPY package*.json ./ # manifests first (better layer caching)
RUN npm ci --omit=dev # install deps at build time
COPY . . # then the source
EXPOSE 3000 # documents the port (does NOT publish it)
CMD ["node", "server.js"] # default command; ENTRYPOINT + CMD = fixed binary + default args
Good to know
Copy the dependency manifests before the source — that ordering is what makes layer caching work for you. EXPOSE documents the port; it does not publish it.
