With a code like this:
package main
import "fmt"
var (
version = "dev"
commit = "n/a"
With a code like this:
package main
import "fmt"
var (
version = "dev"
commit = "n/a"
FROM golang:1.21.0-bullseye as builder | |
COPY . /workdir | |
WORKDIR /workdir | |
ENV CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" | |
ENV GOFLAGS="-buildmode=pie" | |
RUN go build -ldflags "-s -w" -trimpath ./cmd/app |