Skip to content

CICD-114 · Select a named build stage ​

Encyclopedia · Docker image building · All snippets

Previous · CICD-113 · Next · CICD-115

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites Docker Engine or BuildKit on a trusted lab runner.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
docker build --target test -t web:test .

3. How it works ​

Docker sends the selected context to the builder. The Dockerfile instructions and ignore rules determine what reaches the resulting image. The command archives or inspects the selected files. Verify the relative paths and file set before using the archive downstream.

4. Verify the result ​

Ensure test stage runs intended commands. Building a target only executes its dependency graph.

Validation syntax-validated (Bash parse). Status definitions.