Docker Community Forums

Share and learn in the Docker community.

Inject current git commit into docker container


(Andreotica) #1

Hello docker users,

I would like to inject current git commit hash into my GO binary during a build process. Something like this:

go build -ldflags "-X main.githash `git rev-parse HEAD`" service.go

How can i do that if i build my container on the docker hub?