From c43a0a942ebc3a97b882de3d7e374ff497db8ecf Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Tue, 22 Mar 2022 14:57:12 +0100 Subject: [PATCH] Add missing build args when building docker image. --- .github/workflows/release.yml | 3 +++ Dockerfile | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fdac99285..ea806d26a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,3 +93,6 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/numary/ledger:latest,ghcr.io/numary/ledger:${{ github.event.release.tag_name }} + build-args: + APP_SHA: ${{ env.GITHUB_SHA }} + VERSION: ${{ github.event.release.tag_name }} diff --git a/Dockerfile b/Dockerfile index b0eaef80b..bea9ec474 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM golang:1.16-alpine as src-alpine ARG VERSION=latest +ARG APP_SHA RUN apk add --no-cache git gcc build-base COPY . /app WORKDIR /app -RUN CGO_ENABLED=1 GOOS=linux go build -o numary ./ +RUN CGO_ENABLED=1 GOOS=linux go build -o numary \ + -ldflags="-X github.com/numary/ledger/cmd.Version=${VERSION} \ + -X github.com/numary/ledger/cmd.BuildDate=$(date +%s) \ + -X github.com/numary/ledger/cmd.Commit=${APP_SHA}" ./ FROM alpine RUN apk add --no-cache ca-certificates curl