put version in binary properly (#73)

Addresses #71 :

    Set version on the CLI framework.
    Add a build.sh script that injects variables into the build tooling using git and a version file.
    Set version in config.
This commit is contained in:
Tobi Smethurst
2021-06-28 12:17:20 +02:00
committed by GitHub
parent 87cf621e21
commit 4f3b3f5c0b
9 changed files with 38 additions and 11 deletions

View File

@ -1,4 +1,6 @@
FROM golang:1.16.4-alpine3.13 AS builder
RUN apk update && apk upgrade --no-cache
RUN apk add git
# create build dir
RUN mkdir -p /go/src/github.com/superseriousbusiness/gotosocial
@ -11,8 +13,15 @@ ADD testrig /go/src/github.com/superseriousbusiness/gotosocial/testrig
ADD go.mod /go/src/github.com/superseriousbusiness/gotosocial/go.mod
ADD go.sum /go/src/github.com/superseriousbusiness/gotosocial/go.sum
# move .git dir and version for versioning
ADD .git /go/src/github.com/superseriousbusiness/gotosocial/.git
ADD version /go/src/github.com/superseriousbusiness/gotosocial/version
# move the build script
ADD build.sh /go/src/github.com/superseriousbusiness/gotosocial/build.sh
# do the build step
RUN go build ./cmd/gotosocial
RUN ./build.sh
FROM alpine:3.13 AS executor
RUN apk update && apk upgrade --no-cache