compose
compose copied to clipboard
Support language-specific build tools
Description
Recently several language-specific build tools emerged. These tools produce a container image without having to write a Dockerfile. Golang has ko-build. Java got something as well.
(Besides convenience, a strong selling point is efficiency. For instance, ko produces multi-arch images by leveraging cross-compilation support in Golang toolchain. It also takes advantage of different caches in the host, such as module and build caches. Golang workspaces work seamlessly with ko. Finally, if dependencies in private repositories are required, enabling access in a Dockerfile is an annoyance. Eliminated with ko.)
It would be nice if build:
section in docker-compose.yaml
was extended to support these language-specific builders.
One way to do it would be piggy-backing on existing build: URL
syntax. If a schema is not http(s), like e.g. ko://example.org/foo/bar
, look for docker-compose-build-<SCHEMA>
in PATH
. Pass example.org/foo/bar
as an argument to docker-compose-build-ko
and extract image ID from command's stdout.