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
# 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
Download from the command line
curl -L -o Dockerfile https://files.samplefiles.com/code/dockerfile/Dockerfilewget https://files.samplefiles.com/code/dockerfile/Dockerfilehttps://files.samplefiles.com/code/dockerfile/Dockerfileprintf '%s %s\n' 9d495757a1408c5a22aeec34c1088623d3d4095f3765987f521f472c6d59ae14 Dockerfile | shasum -a 256 -cOr check the download in your browser with the checksum calculator.