Closed yemble closed 7 years ago
Question: Are you going to run it locally at all? Or just in the container?
It's possible to have Go just compile it for a different architecture whilst on your Mac.
From the API project:
build: export GOOS=linux
build: export GOARCH=amd64
build: clean
@go build cmd/microcosm/microcosm.go
It's better to have it build on the host as you'll retain Go's partial compilation which dramatically speeds up the time to build.
Might still be worth having a different build step so you retain the option of running locally, but at least if it's built on the host you get faster builds.
Hadn't really thought that far through - I just like the run/refresh workflow and this was a quick fix to stop the container from crashing. Happy to keep this in my fork. If the speed gets on my nerves, I'll do something about it, probably cross compile as you say.
Ensures the executable is built for the same cpu architecture as the running container when using a mounted volume via docker-compose.