ConceptsBuilds & runtimes
Go
What the generated Dockerfile does for a Go project, when you set no build or start command.
The build image downloads the modules with go mod download.
1 / 3
A Go build uses two images. The first image has the Go tools and compiles the app. The second image only runs the binary.
The defaults
| Step | What Ferry does |
|---|---|
| Build image | golang:<version>-alpine. The version comes from the go line of go.mod. The default is 1.23. |
| Run image | alpine:3.20 |
| Dependencies | go mod download, in a cached layer of its own. |
| Build | CGO_ENABLED=0 go build of the root package when it is package main. If not, of the only main package below cmd/<name>. |
| Start | The binary: /usr/local/bin/app. |
Your build command must write its binaries to /out. Ferry installs them in /usr/local/bin.
The run image also has your source tree in /app. This is the directory where the app starts. Thus the app finds its templates and other files.