From 9181961451e65914401234269122c99016a447f0 Mon Sep 17 00:00:00 2001 From: viteshan Date: Thu, 19 May 2022 12:27:07 +0800 Subject: [PATCH] fix: use statically linked https://github.com/vitelabs/go-vite/issues/594 --- Makefile | 8 ++++---- docker/README.md | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d9a32c84a..d51c798dc 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ test: GO111MODULE=on go test ./wallet build_linux_amd64: - env GOOS=linux GO111MODULE=on GOARCH=amd64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux/gvite $(MAIN) + env GOOS=linux CGO_ENABLED=0 GO111MODULE=on GOARCH=amd64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux/gvite $(MAIN) @cp $(shell pwd)/conf/node_config.json $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux/node_config.json @cp $(shell pwd)/bin/bootstrap_linux $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux/bootstrap @@ -48,7 +48,7 @@ build_linux_amd64: @echo "Build linux version done." build_linux_arm64: - env GOOS=linux GO111MODULE=on GOARCH=arm64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux-arm64/gvite $(MAIN) + env GOOS=linux CGO_ENABLED=0 GO111MODULE=on GOARCH=arm64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux-arm64/gvite $(MAIN) @cp $(shell pwd)/conf/node_config.json $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux-arm64/node_config.json @cp $(shell pwd)/bin/bootstrap_linux $(BUILD_DIR)/gvite-$(VITE_VERSION)-linux-arm64/bootstrap @@ -57,7 +57,7 @@ build_linux_arm64: @echo "Build linux-arm64 version done." build_darwin: - env GOOS=darwin GO111MODULE=on GOARCH=amd64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-darwin/gvite $(MAIN) + env GOOS=darwin CGO_ENABLED=0 GO111MODULE=on GOARCH=amd64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-darwin/gvite $(MAIN) @cp $(shell pwd)/conf/node_config.json $(BUILD_DIR)/gvite-$(VITE_VERSION)-darwin/node_config.json @ls -d $(BUILD_DIR)/gvite-$(VITE_VERSION)-darwin/gvite @@ -65,7 +65,7 @@ build_darwin: build_windows: - env GOOS=windows GO111MODULE=on GOARCH=amd64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-windows/gvite-windows-amd64.exe $(MAIN) + env GOOS=windows CGO_ENABLED=0 GO111MODULE=on GOARCH=amd64 go build -o $(BUILD_DIR)/gvite-$(VITE_VERSION)-windows/gvite-windows-amd64.exe $(MAIN) @cp $(shell pwd)/conf/node_config.json $(BUILD_DIR)/gvite-$(VITE_VERSION)-windows/node_config.json @ls -d $(BUILD_DIR)/gvite-$(VITE_VERSION)-windows/gvite-windows-amd64.exe diff --git a/docker/README.md b/docker/README.md index 3d7250e31..ebb886a01 100644 --- a/docker/README.md +++ b/docker/README.md @@ -16,3 +16,11 @@ docker build -t vitelabs/gvite:test -f docker/Dockerfile . docker run -v $HOME/.gvite/:/root/.gvite/ -p 48132:48132 -p 41420:41420 -p 8483:8483 -p 8484:8484 -p 8483:8483/udp -d vitelabs/gvite:test ``` + + +# quickly Build from local binary + +``` +gvite-linux +docker build -t vitelabs/gvite-nightly:test . -f docker/Dockerfile.preBuild +``` \ No newline at end of file