From dc45f32af8ea26ab07a60257cb0b54d73abf742f Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 21 Jul 2024 21:25:49 +0200 Subject: [PATCH] fix: dockerfile build version --- .github/workflows/docker.yml | 3 ++- Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 84775cd..f6e82ae 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -64,6 +64,7 @@ jobs: sbom: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: ${{ steps.meta.outputs.args }} + build-args: | + VERSION=v${{ steps.meta.outputs.version }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 6025820..b4bf097 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.22-alpine3.20 AS build -ARG DOCKER_META_VERSION="untracked" +ARG VERSION="untracked" RUN apk --update add ca-certificates @@ -11,7 +11,7 @@ COPY ./go.sum ./ RUN go mod download COPY . /webdav/ -RUN go build -o main -ldflags="-X 'github.com/hacdias/webdav/v4/cmd.version=$DOCKER_META_VERSION'" . +RUN go build -o main -ldflags="-X 'github.com/hacdias/webdav/v4/cmd.version=$VERSION'" . FROM scratch