check / check (push) Waiting to run
The image's static relink linked glibc's getaddrinfo (from Go's cgo DNS resolver) and dlopen (from SQLite extension loading). A static binary still needs glibc's shared libraries at run time for both, and the Alpine runtime has none. The relink now passes the standard build tags netgo, osusergo and sqlite_omit_load_extension through a GO_TAGS variable, which the Makefile's build target hands to go build as -tags next to GO_LDFLAGS, so the version stamp is composed as before. Model: opus-5-5
87 lines
1.9 KiB
Makefile
87 lines
1.9 KiB
Makefile
.PHONY: bootstrap setup assets test test-browser lint fmt fmt-check check build run dev deps docker clean hooks css css-check version
|
|
|
|
# Default target
|
|
.DEFAULT_GOAL := check
|
|
|
|
# Version stamped into the binary. Derived from git by script/version;
|
|
# override it (`make build VERSION=v1.2.3`) to stamp a given value, which is
|
|
# how the Dockerfile passes its build arg in.
|
|
VERSION ?= $(shell script/version)
|
|
|
|
# An empty override (`make build VERSION=`, or the Dockerfile's `make build
|
|
# VERSION="$VERSION"` when no VERSION build arg was given) means unset,
|
|
# exactly as it does in script/version -- stamping "" would leave the binary
|
|
# reporting no version and the footer back on its "dev" fallback. `override`
|
|
# is required: a plain assignment loses to the command-line definition it
|
|
# exists to correct.
|
|
override VERSION := $(or $(strip $(VERSION)),$(shell script/version))
|
|
|
|
# Extra linker flags and build tags for the build target. The static
|
|
# relink in the Dockerfile passes -extldflags and its build tags through
|
|
# these rather than a -ldflags of its own, so composing flags cannot drop
|
|
# the version stamp.
|
|
#
|
|
# The build target itself always passes -trimpath and -s -w, as the Go
|
|
# Dockerfile in REPO_POLICIES.md does: no build paths, symbol table or
|
|
# debug information in the binary.
|
|
GO_LDFLAGS ?=
|
|
GO_TAGS ?=
|
|
|
|
bootstrap:
|
|
@script/bootstrap
|
|
|
|
setup:
|
|
@script/setup
|
|
|
|
assets:
|
|
@script/assets
|
|
|
|
test:
|
|
@script/test
|
|
|
|
test-browser:
|
|
@script/test-browser
|
|
|
|
lint:
|
|
@script/lint
|
|
|
|
fmt:
|
|
@script/fmt
|
|
|
|
fmt-check:
|
|
@script/fmt-check
|
|
|
|
check:
|
|
@script/check
|
|
|
|
build: assets
|
|
go build -trimpath -tags '$(GO_TAGS)' -ldflags '$(strip -s -w -X main.version=$(VERSION) $(GO_LDFLAGS))' -o bin/webhooker ./cmd/webhooker
|
|
|
|
run: build
|
|
./bin/webhooker
|
|
|
|
dev: assets
|
|
go run ./cmd/webhooker
|
|
|
|
deps:
|
|
go mod download
|
|
go mod tidy
|
|
|
|
version:
|
|
@echo $(VERSION)
|
|
|
|
docker:
|
|
@script/docker
|
|
|
|
clean:
|
|
rm -rf bin/
|
|
|
|
hooks:
|
|
@script/install-precommit
|
|
|
|
css:
|
|
@script/css
|
|
|
|
css-check:
|
|
@script/css-check
|