Code · 1 file

Sample Dockerfile File

A Dockerfile defines how to build a container image. This sample is a multi-stage build with a health check. The Dockerfile sample is a small program — a customer record, a VIP check and a formatted total — that is the same in every language we offer, so you can compare them side by side.

Dockerfile · 342 B

Sample Dockerfile file

An idiomatic Dockerfile example: a customer record type, a VIP check, a total and a formatted loop — the same program in every language we offer.

CC0 · free for any use · Verified by an independent tool · Report a problem

Dockerfile — first linesDockerfile
# Sample multi-stage Dockerfile — samplefiles.com
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:1.27-alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s CMD wget -qO- http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]

File details

Size
342 B (342 bytes)
MIME type
text/plain
SHA-256
9d495757a1408c5a22aeec34c1088623d3d4095f3765987f521f472c6d59ae14
MD5
e8f30776b9a59ae21090b2a61ffc35de

Download from the command line

curl -L -o Dockerfile https://files.samplefiles.com/code/dockerfile/Dockerfile

Or check the download in your browser with the checksum calculator.