šŸ”Ø

Dockerfile & Build

Building custom images with Dockerfiles

Step 1 of 3

What is a Dockerfile?

A Dockerfile is a text file with instructions to build an image. Each instruction creates a layer. Layers are cached for faster builds.

bash
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
Application codetop layer
Dependencies
Config files
OS packages
Base OS layerbase layer