adding arg for apiVersion based on git release

This commit is contained in:
Tobias Lindberg
2021-12-23 11:27:21 +01:00
parent 5bd67b047d
commit 7e648a498f
3 changed files with 7 additions and 3 deletions
+2
View File
@@ -54,3 +54,5 @@ jobs:
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
apiVersion=${{ github.event.release.tag_name }}
+4 -1
View File
@@ -1,6 +1,9 @@
# get latest golang container
FROM golang:1.17.5
# get args
ARG apiVersion=unknown
# create and set workingfolder
WORKDIR /go/src/
@@ -14,7 +17,7 @@ RUN go mod download
COPY src/ .
# compile the program
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags="-w -s -X 'main.apiVersion=${apiVersion}'" -o app .
# get latest alpine container
+1 -2
View File
@@ -14,8 +14,7 @@ import (
)
// setting TeslaMateApi version number
// TODO: get the value from git-tag later..
var apiVersion = "1.11.0"
var apiVersion = "unspecified"
// defining db var
var db *sql.DB