From 4f3b3f5c0b00b8c47c7e7d8e6c2dda624e114cde Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 28 Jun 2021 12:17:20 +0200 Subject: 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. --- Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 4fa961e5e..fe94ef5a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 -- cgit v1.3