#Is there a Go example somewhere of a
1 messages ยท Page 1 of 1 (latest)
Something like this? https://github.com/kpenfound/hello-eks/blob/main/ci/main.go#L39-L56
it does a multistage build by building in a golang image and then taking the build artifact and putting it in an alpine image
I suppose a multi-stage build would be one way of doing it. I was thinking, "Container A compiles a binary that containers B, C, and D use in parallel"
if I were to do it with just Docker I would probably create a volume, run the container to compile the program, then use that same volume on the other containers.
Yeah I think the way of accomplishing that should be the same. The
base.FS().WithFile("/bin/hello", builder.File("/src/hello")
is the important bit where I grab a file (or directory) from another container and put it in the new one. Depending on what you're doing (i.e. not publishing or saving the container), you could do this with mounts instead and save a few steps too
with mounts it would look like
mynewcontainer.WithMountedDirectory("/app", myothercontainer.Directory("/app"))
gotya. That's helpful, thank you. I wonder if it'd be possible to make your pipeline skip the "go build -o hello" and just provide the "hello" binary if nothing changed, sort of like how a multi-stage build would behave with docker. ๐ค
That's exactly what it'll do ๐ But that's handled behind the scenes in the engine
ohhhh that's awesome.