Backend Development
Step 19 / 20120 min

Docker

Shipping Backend

Explanation

Containers freeze Node, OS libraries, and your app so staging matches production.

Code example

dockerfile
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 4000
CMD ["node", "src/index.js"]

Helpful resources

Exercise

Dockerize the API and run it with Compose next to PostgreSQL.