docker:go
Background
Provided that you are writing plans in Go and using the sync service sdk, docker:go
is the builder you want to use. This builder produces plan artifacts which are usable on the local:docker
or cluster:k8s
runner.
Features
Produces docker containers which can run on docker-powered runners.
Linkage with a custom sync service SDK via
--link-sdk
flagSimple command-line dependency mapping using the
--dep
flagbusybox
base for easy container troubleshooting.customizable build
Troubleshooting
Most build failures are caused by a problem with the plan code rather than the build process. Here are a few tips to help figure out what's going on when there are build failures.
Try to build the plan yourself. These are just executable files after all! Frequently, build problems can be revealed by simply trying to run the plan as it is. If you can't build it like this, then the builder won't be able to either.
Make sure you have correctly initialized
go.mod
. The builder may throw errors when doing module replacements not used correctly.Remove any custom module replace lines you have in
go.mod
. The builder will do this for you with appropriate flags.
Customizing the build
when using the docker:go
builder, plans are build using a standard template. This template is typically all that is needed, but for some plans, the default docker build may be too inflexible. For cases such as this, the Dockerfile can be extended to include custom directives.
?> If you want to just provide your own Dockerfile, use the docker:generic
builder instead.
This feature is best explained by showing how it works. This is the default Dockerfile the docker:go
builder will use to build plans. Notice that this is a go template. The template has a few points where customizations can be added.
To add additional directives, add a section to your plan's manifest.toml
. This example will add echo statements to each of the templated sections.
Learn More
See an example plan which uses a customized Dockerfile, see here
Interested in how this works? All the Testground builders can be seen here
Last updated