docker-tools icon indicating copy to clipboard operation
docker-tools copied to clipboard

Migrate off of Cottle templating engine

Open lbussell opened this issue 10 months ago • 1 comments

Cottle, our templating library, presents some usability issues with our Dockerfile and Readme templates:

  1. Confusing syntax with no linter/syntax highlighting support
  2. Errors are difficult to track down and it's sometimes unclear what the problem is
  3. Managing whitespace is difficult

We should migrate to a different templating engine. The ideal templating engine would fulfill the following requirements:

  1. Extensible, so that we can add our own custom functions/commands
  2. Composable (Not strictly required, we currently shoehorn this into Cottle via its extensibility)
  3. General-purpose enough to work for both Dockerfiles and text (Markdown)
  4. Syntax highlighting and clear errors
  5. Good support

Some options immediately come to mind:

  1. Razor - built in to .NET, but requires ASP.NET Core libraries
  2. T4
  3. Fluid (Liquid) - port of Liquid templating engine to .NET, maintained by .NET team member, popular on NuGet

lbussell avatar Feb 25 '25 02:02 lbussell

[Triage] Related: https://github.com/dotnet/dotnet-docker/issues/6251

lbussell avatar Mar 03 '25 19:03 lbussell