stencila/dockta

refactor: generators for alternative base image types

Opened this issue · 0 comments

For our Nix integration we ended up taking the approach of generating a Dockerfile which is based on the nixos/nix image (and copying default.nix into it). Currently, the code for this is spread between cli-nix.ts and NixGenerator.nix.

A more general approach might be to refactor generators so that Dockter can support multiple base images. e.g. including Alpine (for small very, self contained, images)

A new command line option, base, would be used to specify the base image

dockter build --base=ubuntu:18.10

With aliases for commonly used images.

dockter build --<ubuntu,nix,alpine>

The best way to do this is refactoring is to have generators for each base image type e.g. UbuntuGenerator, NixGenerator and get rid of the language specific generators e.g. PythonGenerator.