File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed
Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change 11FROM docker.io/library/golang:alpine as builder
22
3- ARG PB_BUILD_VERSION
4-
53ARG CLI_VERSION=0.0.6
64ARG CLI_PLATFORM=linux_amd64
75
@@ -13,7 +11,7 @@ RUN set -ex \
1311 && apk add --no-cache build-base ca-certificates curl \
1412 && go mod download \
1513 && go mod verify \
16- && PB_BUILD_VERSION= "$PB_BUILD_VERSION" make build \
14+ && make build \
1715 && chmod +x /build/out/pushbits \
1816 && curl -q -s -S -L -o /tmp/pbcli_${CLI_VERSION}.tar.gz https://github.com/pushbits/cli/releases/download/v${CLI_VERSION}/pbcli_${CLI_VERSION}_${CLI_PLATFORM}.tar.gz \
1917 && tar -C /usr/local/bin -xvf /tmp/pbcli_${CLI_VERSION}.tar.gz pbcli \
Original file line number Diff line number Diff line change @@ -5,15 +5,10 @@ TESTS_DIR := ./tests
55GO_FILES := $(shell find . -type f \( -iname '* .go' \) )
66GO_MODULE := github.com/pushbits/server
77
8- PB_BUILD_VERSION ?= $(shell git describe --tags)
9- ifeq ($(PB_BUILD_VERSION ) ,)
10- _ := $(error Cannot determine build version)
11- endif
12-
138.PHONY : build
149build :
1510 mkdir -p $(OUT_DIR )
16- go build -ldflags=" -w -s -X main.version= $( PB_BUILD_VERSION ) " -o $(OUT_DIR ) /pushbits ./cmd/pushbits
11+ go build -ldflags=" -w -s" -o $(OUT_DIR ) /pushbits ./cmd/pushbits
1712
1813.PHONY : clean
1914clean :
@@ -63,7 +58,6 @@ swag: build
6358.PHONY : docker_build_dev
6459docker_build_dev :
6560 podman build \
66- --build-arg=PB_BUILD_VERSION=dev \
6761 -t local/pushbits .
6862
6963.PHONY : run_postgres_debug
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ package main
44import (
55 "os"
66 "os/signal"
7+ "runtime/debug"
78 "syscall"
89
910 "github.com/pushbits/server/internal/authentication/credentials"
@@ -15,8 +16,6 @@ import (
1516 "github.com/pushbits/server/internal/runner"
1617)
1718
18- var version string
19-
2019func setupCleanup (db * database.Database , dp * dispatcher.Dispatcher ) {
2120 c := make (chan os.Signal , 2 )
2221 signal .Notify (c , os .Interrupt , syscall .SIGTERM )
@@ -30,11 +29,13 @@ func setupCleanup(db *database.Database, dp *dispatcher.Dispatcher) {
3029}
3130
3231func printStarupMessage () {
33- if len ( version ) == 0 {
34- log . L . Panic ( "Version not set" )
35- } else {
36- log . L . Printf ( "Starting PushBits %s" , version )
32+ buildInfo , ok := debug . ReadBuildInfo ()
33+ if ! ok {
34+ log . L . Fatalln ( "Build info not available" )
35+ return
3736 }
37+
38+ log .L .Printf ("Starting PushBits %s" , buildInfo .Main .Version )
3839}
3940
4041// @title PushBits Server API Documentation
You can’t perform that action at this time.
0 commit comments