Importing
The Docker lexicon can parse existing docker-compose.yml files and Dockerfiles and generate typed TypeScript equivalents.
Import docker-compose.yml
Section titled “Import docker-compose.yml”chant import --lexicon docker docker-compose.yml -o src/compose.tsGiven:
services: api: image: myapp:1.0 ports: - "8080:8080" environment: NODE_ENV: productionvolumes: pgdata: nullProduces src/compose.ts:
import { Service, Volume } from "@intentius/chant-lexicon-docker";
export const api = new Service({ image: "myapp:1.0", ports: ["8080:8080"], environment: { NODE_ENV: "production", },});
export const pgdata = new Volume({});Import Dockerfile
Section titled “Import Dockerfile”chant import --lexicon docker Dockerfile -o src/dockerfile.tsWorkflow
Section titled “Workflow”Import is a one-time migration step, not an ongoing sync. After importing:
- Review the generated TypeScript — complex fields may need manual adjustment
- Run
chant lint src/to catch issues - Run
chant build src --lexicon docker -o docker-compose.ymland diff against the original - Delete the original file and commit the TypeScript source
Limitations
Section titled “Limitations”extends:(Compose file inheritance) is not supported- Build args with complex shell expressions may require manual cleanup
- Environment variable syntax (
${VAR}) is preserved as-is; replace withenv()manually if desired