Build static Go binary
Signed-off-by: Tamal Saha <tamal@appscode.com>
This commit is contained in:
parent
b060c751ce
commit
a266027f6c
51
Makefile
51
Makefile
|
@ -17,31 +17,30 @@ deps:
|
||||||
go get -u github.com/knadh/stuffbin/...
|
go get -u github.com/knadh/stuffbin/...
|
||||||
cd frontend && yarn install
|
cd frontend && yarn install
|
||||||
|
|
||||||
# Run the JS frontend server in dev mode.
|
# Build the backend to ./listmonk.
|
||||||
.PHONY: run-frontend
|
.PHONY: build
|
||||||
run-frontend:
|
build:
|
||||||
export VUE_APP_VERSION="${VERSION}" && cd frontend && yarn serve
|
CGO_ENABLED=0 go build -o ${BIN} -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}'" cmd/*.go
|
||||||
|
|
||||||
# Build the JS frontend into frontend/dist.
|
|
||||||
.PHONY: build-frontend
|
|
||||||
build-frontend:
|
|
||||||
export VUE_APP_VERSION="${VERSION}" && cd frontend && yarn build
|
|
||||||
|
|
||||||
# Run the backend.
|
# Run the backend.
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run: build
|
run: build
|
||||||
./${BIN}
|
./${BIN}
|
||||||
|
|
||||||
# Build the backend to ./listmonk.
|
# Build the JS frontend into frontend/dist.
|
||||||
.PHONY: build
|
.PHONY: build-frontend
|
||||||
build:
|
build-frontend:
|
||||||
go build -o ${BIN} -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}'" cmd/*.go
|
export VUE_APP_VERSION="${VERSION}" && cd frontend && yarn build
|
||||||
|
|
||||||
# pack-releases runns stuffbin packing on the given binary. This is used
|
# Run the JS frontend server in dev mode.
|
||||||
# in the .goreleaser post-build hook.
|
.PHONY: run-frontend
|
||||||
.PHONY: pack-bin
|
run-frontend:
|
||||||
pack-bin:
|
export VUE_APP_VERSION="${VERSION}" && cd frontend && yarn serve
|
||||||
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
|
|
||||||
|
# Run Go tests.
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
go test ./...
|
||||||
|
|
||||||
# Bundle all static assets including the JS frontend into the ./listmonk binary
|
# Bundle all static assets including the JS frontend into the ./listmonk binary
|
||||||
# using stuffbin (installed with make deps).
|
# using stuffbin (installed with make deps).
|
||||||
|
@ -49,6 +48,12 @@ pack-bin:
|
||||||
dist: build build-frontend
|
dist: build build-frontend
|
||||||
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
|
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
|
||||||
|
|
||||||
|
# pack-releases runns stuffbin packing on the given binary. This is used
|
||||||
|
# in the .goreleaser post-build hook.
|
||||||
|
.PHONY: pack-bin
|
||||||
|
pack-bin:
|
||||||
|
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
|
||||||
|
|
||||||
# Use goreleaser to do a dry run producing local builds.
|
# Use goreleaser to do a dry run producing local builds.
|
||||||
.PHONY: release-dry
|
.PHONY: release-dry
|
||||||
release-dry:
|
release-dry:
|
||||||
|
@ -58,13 +63,3 @@ release-dry:
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release:
|
release:
|
||||||
goreleaser --parallelism 1 --rm-dist --skip-validate
|
goreleaser --parallelism 1 --rm-dist --skip-validate
|
||||||
|
|
||||||
# Opens the cypress frontend tests UI.
|
|
||||||
.PHONY: open-frontend-tests
|
|
||||||
open-frontend-tests:
|
|
||||||
cd frontend && ./node_modules/cypress/bin/cypress open
|
|
||||||
|
|
||||||
# Run Go tests.
|
|
||||||
.PHONY: test
|
|
||||||
test:
|
|
||||||
go test ./...
|
|
||||||
|
|
Loading…
Reference in New Issue