From 901286d98ec27faa7f255146ce38d7c4a87f30ed Mon Sep 17 00:00:00 2001 From: perennial Date: Sun, 22 Sep 2024 00:46:57 +1000 Subject: [PATCH] Changes for #104 --- .dockerignore | 7 ++++--- Makefile | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index b5fd7c4..ad307b3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,8 @@ # Git-related files -.git/ -.gitignore +# Required for commit hash +# ref: https://codeberg.org/VnPower/PixivFE/pulls/104 +# .git/ +# .gitignore # Docker-related files .dockerignore @@ -18,4 +20,3 @@ mkdocs.yml LICENSE README.md doc/ - diff --git a/Makefile b/Makefile index 81168dc..94d56a4 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ BINARY_NAME=pixivfe TARGETOS ?= $(shell go env GOOS) TARGETARCH ?= $(shell go env GOARCH) +GIT_COMMIT := $(shell git describe --always 2>/dev/null) # Include environment variables from .env if it exists -include .env @@ -19,7 +20,7 @@ fmt: build: @echo "Building $(BINARY_NAME)..." go mod download - CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -v -ldflags="-extldflags=-static -X codeberg.org/vnpower/pixivfe/v2/config.REVISION=`git describe --always 2>/dev/null`" -tags netgo -o $(BINARY_NAME) + CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -v -ldflags="-extldflags=-static -X codeberg.org/vnpower/pixivfe/v2/config.REVISION=$(GIT_COMMIT)" -tags netgo -o $(BINARY_NAME) test: @echo "Running tests..."