chore: add version to binary in containers

This commit is contained in:
Leon Lenzen 2022-06-18 11:36:09 +02:00
parent 3ae340527f
commit d4a550bb4c
4 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,6 @@
# Builder image
FROM docker.io/golang:1.18.0-bullseye AS build
ARG VERSION=dev
ENV GOPATH /go
WORKDIR /go/src/headscale
@ -8,7 +9,7 @@ RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go install -a ./cmd/headscale
RUN CGO_ENABLED=0 GOOS=linux go install -ldflags="-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$VERSION" -a ./cmd/headscale
RUN strip /go/bin/headscale
RUN test -e /go/bin/headscale