hugo/Makefile
Sven Dowideit 7bc5d3663f Use a Docker container to build hugo
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-01-04 12:47:23 -05:00

33 lines
725 B
Makefile

# Adds build information from git repo
#
# as suggested by tatsushid in
# https://github.com/spf13/hugo/issues/540
COMMIT_HASH=`git rev-parse --short HEAD 2>/dev/null`
BUILD_DATE=`date +%FT%T%z`
LDFLAGS=-ldflags "-X github.com/spf13/hugo/hugolib.CommitHash=${COMMIT_HASH} -X github.com/spf13/hugo/hugolib.BuildDate=${BUILD_DATE}"
all: gitinfo
install: install-gitinfo
help:
echo ${COMMIT_HASH}
echo ${BUILD_DATE}
gitinfo:
go build ${LDFLAGS} -o hugo main.go
install-gitinfo:
go install ${LDFLAGS} ./...
no-git-info:
go build -o hugo main.go
docker:
docker build -t hugo .
docker rm -f hugo-build || true
docker run --name hugo-build hugo ls /go/bin
docker cp hugo-build:/go/bin/hugo .
docker rm hugo-build