A minimal “Hello World” application in Go—built and packaged entirely in containers using a multi-stage Containerfile. The runtime image is pushed automatically via GitHub Actions.
I created this project because I wanted to:
- Experiment with the Go toolchain only via containers (see
app/mod.sh). - Learn and demonstrate a multi-stage build pattern in Containerfile (builder → runtime).
- Automate building and pushing the final runtime image using GitHub Actions.
- Language: Go 1.24
- Container Base Images:
- Builder:
docker.io/golang:1.24 - Runtime:
alpine:3.22
- Builder:
- Output:
- A lean runtime image (
pjfsu/go-hello-world-runtime:latest) containing a single binary that printsHello World!.
- A lean runtime image (
.
├── app
│ ├── app.go # Hello World Go source
│ ├── go.mod # Module definition
│ ├── go.sum # Dependency checksums
│ ├── Containerfile # Multi-stage builder → runtime
│ └── mod.sh # Init & tidy Go modules via container
├── .github
│ └── workflows
│ └── build_push.yml # GH Actions: build & push runtime image
├── LICENSE # GPLv3
└── README.md # This documentationThis project’s GitHub Action (.github/workflows/build_push.yml) will:
- Log in to Docker Hub using repository secrets
DOCKERHUB_USERNAMEandDOCKERHUB_TOKEN. - Build only the
runtimestage fromapp/Containerfile. - Push the image to
docker.io/pjfsu/go-hello-world-runtime:latest.
user@localhost:~$ podman run --rm go-hello-world-runtime:latest
Hello World!
user@localhost:~$ podman images docker.io/pjfsu/go-hello-world-runtime:latest --format '{{.Size}}'
10.8 MBThis project is licensed under the GPLv3. See the LICENSE file for details.