You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dockerfiles to build Docker images for your Go app. It makes use of Docker's multi-stage build feature to create the Go application binary, and then attach it to a minimal base image. The Go version used is 1.22, though it should work for most Go versions (not tested). You'll have to tweak the Dockerfile to COPY any static files required by the application, to be copied to the final image.
It's important that you understand Go build flags to build a functioning binary for your application. Not all apps will work with build configuration provided in the Dockerfiles.
$ docker run -p 8080:8080 --rm -ti webgo-helloworld-alpine
$ docker run -p 8080:8080 --rm -ti webgo-helloworld-debian
$ docker run -p 8080:8080 --rm -ti webgo-helloworld-busybox
$ docker run -p 8080:8080 --rm -ti webgo-helloworld-scratch
The gopher
The gopher used here was created using Gopherize.me. The expert Docker gopher tells us how to build production ready, secure, Docker images for Go applications!