Skip to content
Testaroo
dockerfile1.2 KB

Dockerfile, Multi-Stage Build Definition

A three-stage Dockerfile with a syntax directive, build args interpolated into FROM lines, a heredoc COPY, multi-line LABEL and ENV continuations, a non-root USER, and HEALTHCHECK in exec form. Inert: every base image is a fictional example.invalid reference.

Preview, first 41 linesdockerfile
# syntax=docker/dockerfile:1
# Multi-stage build definition. INERT: this is a parsing fixture, not a build. Every base image
# is a fictional registry.example.invalid reference, nothing is fetched, and no credential,
# token, or private host appears anywhere in it.

ARG BASE_TAG=1.4.0
ARG NODE_MAJOR=20

FROM registry.example.invalid/ci/node:${NODE_MAJOR} AS deps
WORKDIR /src
COPY package.json package-lock.json ./
RUN npm ci --omit=dev

FROM registry.example.invalid/ci/node:${NODE_MAJOR} AS build
WORKDIR /src
COPY --from=deps /src/node_modules ./node_modules
COPY . .
RUN npm run build

FROM registry.example.invalid/base/distroless:${BASE_TAG} AS runtime
LABEL org.opencontainers.image.title="orders" \
      org.opencontainers.image.version="${BASE_TAG}" \
      org.opencontainers.image.source="https://git.example.invalid/example-org/orders"

ENV NODE_ENV=production \
    LOG_LEVEL=info

WORKDIR /app
COPY --from=build --chown=10001:10001 /src/build /app
COPY <<EOF /app/banner.txt
orders service
built from a fixture, not from real source
EOF

USER 10001:10001
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=2s --retries=3 CMD ["/app/healthcheck"]
STOPSIGNAL SIGTERM
ENTRYPOINT ["/app/server"]
CMD ["--port", "8080"]

Specifications

Stages
3
Named Stages
deps, build, runtime
Build Args
2
Has Heredoc Copy
true
Has Syntax Directive
true
Runs As User
10001
Instructions
24

Testing contract

Expected to pass
Scenario
Parse a Dockerfile with named multi-stage builds, ARG interpolation, and a heredoc COPY
Expected result
Three named stages resolve, the ${NODE_MAJOR} ARG interpolates into two FROM lines, and the heredoc COPY is read as a single instruction rather than as stray lines

What is a .dockerfile file?

A Dockerfile is a plain-text script of instructions that Docker reads to build a container image layer by layer, using directives like FROM, RUN, COPY, and CMD. Each instruction defines a step in assembling a reproducible image. It is the standard definition format for containerized applications.

How to use this file

Use an example Dockerfile to test instruction parsers and linters, build-tool integration, and tooling that analyzes or generates container image definitions.

How to use this file for testing

“Dockerfile, Multi-Stage Build Definition” is a deterministic Testaroo fixture for Config parsing, Syntax highlighting, Editor testing. TOML and INI configuration files with nested sections and typed values, for testing config parsers and loaders.

Documented properties for this file: DOCKERFILE · 1,230 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such, expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Point your config loader at the file and assert it reads the documented sections and typed values, including any deliberately-tricky nesting or comments.

Generated by generation/pipelines.py. Free for any use, no attribution required, license.