Skip to content

Docker

llms.txt lists every page for an agent
Optional: hand this page to your coding agentThe steps work by hand too.
Show the whole prompt
Read https://intentius.io/chant/lexicons/docker/ and https://intentius.io/chant/lexicons/docker/dockerfiles/ first.
Bring this project's Docker files into chant TypeScript under src/.
Import each existing file. `-o` names a directory, and each import writes main.ts in it: `chant import --lexicon docker docker-compose.yml -o src/compose/`, and `chant import --lexicon docker Dockerfile -o src/<name>/` for each Dockerfile.
An imported Dockerfile is exported as `app`. Rename each export after its image, since the export name sets the output file (Dockerfile.<export>), and point the Compose service's `build.dockerfile` at that export (`dockerfile: webImage`) instead of the old file name.
Write every Dockerfile stage as an ordered `steps` list, one instruction per step, with FROM as the stage's `from` and ARGs before the first FROM in `globalArgs`:
  steps: [{ workdir: "/app" }, { copy: "package*.json ./" }, { run: "npm ci" }, { copy: ". ." }, { user: "node" }, { cmd: ["node", "dist/index.js"] }]
Where two Dockerfiles repeat a stage or a run of steps, export it once as a const (a `DockerfileStage` or a `DockerfileStep[]`) from its own module and import it in both. Spread imported consts, not function results; a Dockerfile that needs parameters is a `Composite`.
Run `chant build src --lexicon docker -o build/docker-compose.yml` (Dockerfiles are written beside it) and compare with the original files, then `chant lint src`. Run `chant lint src --fix` for DKRS002 (per-kind fields to `steps`, then reorder the steps it writes), fix every other finding by hand, and repeat until lint is clean.
Report the generated docker-compose.yml and each Dockerfile.<name>, and any finding you left and why.
Do not push an image, run `docker compose up` against anything but the local Docker daemon, or change files outside this project.
Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.

The Docker lexicon provides typed constructors for Docker Compose services and Dockerfile build instructions — services, volumes, networks, configs, secrets, and multi-stage Dockerfiles.

Terminal window
npm install --save-dev @intentius/chant-lexicon-docker
import { Service, Volume, Dockerfile, env } from "@intentius/chant-lexicon-docker";
export const db = new Service({
image: "postgres:16-alpine",
environment: {
POSTGRES_DB: "myapp",
POSTGRES_PASSWORD: env("DB_PASSWORD", { required: true }),
},
volumes: ["pgdata:/var/lib/postgresql/data"],
});
export const pgdata = new Volume({});
export const api = new Service({
image: "myapp:1.0",
ports: ["8080:8080"],
depends_on: ["db"],
});

Build:

Terminal window
chant build src --lexicon docker -o docker-compose.yml
EntityOutput fileSection
Servicedocker-compose.ymlservices:
Volumedocker-compose.ymlvolumes:
Networkdocker-compose.ymlnetworks:
Configdocker-compose.ymlconfigs:
Secretdocker-compose.ymlsecrets:
DockerfileDockerfile.{name}—
MetricCount
Resources6
Property types0
Services2
Intrinsic functions1
Pseudo-parameters0
Lint rules16

Lexicon version: 0.124.34
Namespace: Docker

chant