Original source: https://github.com/callicoder/go-docker
Normal docker build (not using modules) - image size is 775MB
docker build . -t go-sample-app-full
Optimized Build (with modules - image size is 389MB
docker build . -f Dockerfile.mod -t go-sample-app-modules
Multi-stage build (fully optimized) - image size is 16 MB
docker build . -f Dockerfile.multistage -t go-sample-app-multi
docker run -p 8080:8080 go-sample-app-multi
and then visit in your browser
Sample pipelines:
- Simple pipeline
- Pipeline with Go modules and unit tests
- Multistage Docker image and embedded unit tests
Read https://codefresh.io/docs/docs/learn-by-example/golang/golang-hello-world/ for more details push11sq