Skip to content

๐Ÿ–ฅ๏ธ docker_build plugin

Overview

The microCI docker_build plugin builds a Docker image locally. Use it when the pipeline should produce and tag a local image (optionally pushed) as part of the same portable workflow.

Features

  • Local image build โ€” docker build from a Dockerfile directory.
  • Tag and optional push โ€” :latest tagging and docker push for versioned and latest tags.

Setup and configuration

Add a pipeline step in .microCI.yml and configure the docker_build plugin under plugin.

Specific configuration

Parameter Type Required Description
name string yes Must be docker_build.
folder string no Folder with the Dockerfile (default dockerfiles).
dockerfile string no Dockerfile name (default Dockerfile).
target string no Target image name (default my_image).
version string no Version tag (default 0.1.0).
is_latest bool no Also tag :latest (default false).
push bool no Push versioned (and :latest) tags (default false).

Configuration notes

  • The build runs docker build -t <target>:<version> -f <dockerfile> . inside <folder>.
  • push: true also runs docker login before pushing.
  • is_latest tags both the versioned and :latest targets when push is enabled.
  • Note: src/main.cpp currently registers docker_build with DocmdPluginStepParser instead of DockerBuildPluginStepParser (which exists in src/). The dedicated parser is the intended behavior; do not commit the template as-is without fixing this.

Example

steps:
  - name: "Build docker image"
    description: "Builds a docker image"
    plugin:
      name: docker_build
      folder: folder_with_dockerfile
      dockerfile: alternative.Dockerfile
      target: intmain/my_image
      version: 0.1.0
      is_latest: true
      push: false

Notes

  • The built image is written on the local registry/docker.

โš™๏ธ Common configuration

All microCI steps share the same set of common fields. These are not plugin-specific: they apply to every plugin and are documented once in the shared snippet so each plugin page stays focused on its own parameters.

Plugin common

Structure

---
docker: "debian:stable-slim"    # optional global default image for all steps
envs:                           # optional global env vars (map)
steps:                          # required; a list of steps
  - name: "Step title"          # required; unique-ish human label
    description: "..."          # optional
    plugin:                     # required
      name: <plugin>            # required; exact plugin id string
      # ... plugin-specific fields (read the plugin page!)

Step-level common fields

Field Type Default Notes
name string โ€” (required) shown by microCI -l, used in logs
description string โ€” free text, stored in the observability db
docker string global docker: or debian:stable-slim image used for the step container
network none | bridge | host none bridge/host when the step needs network (fetch, apt, git push)
run_as root | user user in templates user id inside the container
uid / gid string host $(id -u) / $(id -g) custom ownership for outputs
envs map โ€” values may reference ${VAR} from .env, .env.yml or $HOME/.microCI.env
volumes list of {source, destination, mode} โ€” mode: rw (or ro); host paths mounted in the container
devices list of strings โ€” e.g. "/dev/dri/"; passed to docker
privileged bool false needed for picotool USB access
ssh map {copy_from, copy_to, format} โ€” inject SSH keys; format: "id_ed25519" etc.; with only format, the key is mounted from the default location for git ops
only string tag โ€” step runs ONLY via microCI -O <tag>; otherwise skipped in normal runs

Workspace

The workspace inside the container is /microci_workspace (the repo root is mounted there). The generated script is plain Bash: microCI | bash.

Secrets and environment files

Secrets (tokens, credentials for minio/jfrog/git) are never hardcoded in .microCI.yml. They live in environment files, referenced as "${VAR}":

File Format
$HOME/.microCI.env VAR=VALUE
.env (project root) VAR=VALUE
.env.yml (project root) VAR: VALUE

unsafe plugin exception

The unsafe plugin runs commands directly on the host and rejects these step fields: docker, network, volumes, run_as, devices, ssh.