From 33b8bc2cdead0bb5f57ef5b340bb553f0b0858bb Mon Sep 17 00:00:00 2001 From: medcl Date: Sun, 8 Nov 2020 11:04:41 +0800 Subject: [PATCH] fix package and build --- .gitignore | 3 ++- Makefile | 50 +++++++++++++++++++++++++------------------- README.md | 1 + build.bat | 2 +- web/.dockerignore | 5 +++++ web/config/config.js | 2 +- web/package.json | 23 +++++++++++--------- 7 files changed, 51 insertions(+), 35 deletions(-) create mode 100644 web/.dockerignore diff --git a/.gitignore b/.gitignore index b248c042..6fc1423b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ appveyor.yml /.public /vendor /bin -*.exe \ No newline at end of file +*.exe +web/.github/ \ No newline at end of file diff --git a/Makefile b/Makefile index 673d0449..891f67c8 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ APP_NAME := logging-center APP_VERSION := 1.0.0_SNAPSHOT APP_CONFIG := $(APP_NAME).yml APP_STATIC_FOLDER := .public +APP_STATIC_PACKAGE := public APP_UI_FOLDER := ui APP_PLUGIN_FOLDER := plugin @@ -25,11 +26,22 @@ PATH := $(PATH):$(GOPATH)/bin # Go environment CURDIR := $(shell pwd) OLDGOPATH:= $(GOPATH) -NEWGOPATH:= $(CURDIR):$(CURDIR)/vendor:$(GOPATH) + +# INFINI framework +INFINI_BASE_FOLDER := $(OLDGOPATH)/src/infini.sh/ +FRAMEWORK_FOLDER := $(INFINI_BASE_FOLDER)framework/ +FRAMEWORK_REPO := ssh://git@git.infini.ltd:64221/infini/framework.git +FRAMEWORK_BRANCH := master +FRAMEWORK_VENDOR_FOLDER := $(CURDIR)/../vendor/ +FRAMEWORK_VENDOR_REPO := ssh://git@git.infini.ltd:64221/infini/framework-vendor.git +FRAMEWORK_VENDOR_BRANCH := master + + +NEWGOPATH:= $(CURDIR):$(FRAMEWORK_VENDOR_FOLDER):$(GOPATH) GO := GO15VENDOREXPERIMENT="1" GO111MODULE=off go -GOBUILD := GOPATH=$(NEWGOPATH) CGO_ENABLED=1 $(GO) build -ldflags -s -gcflags "-m" -x --work -GOBUILDNCGO := GOPATH=$(NEWGOPATH) CGO_ENABLED=0 $(GO) build -ldflags -s +GOBUILD := GOPATH=$(NEWGOPATH) CGO_ENABLED=0 GRPC_GO_REQUIRE_HANDSHAKE=off $(GO) build -ldflags='-s -w' -gcflags "-m" --work +GOBUILDNCGO := GOPATH=$(NEWGOPATH) CGO_ENABLED=1 $(GO) build -ldflags -s GOTEST := GOPATH=$(NEWGOPATH) CGO_ENABLED=1 $(GO) test -ldflags -s ARCH := "`uname -s`" @@ -38,12 +50,6 @@ MAC := "Darwin" GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) PKGS=$(go list ./... | grep -v /vendor/) -INFINI_BASE_FOLDER := $(GOPATH)/src/infini.sh/ -FRAMEWORK_FOLDER := $(INFINI_BASE_FOLDER)/framework/ -FRAMEWORK_BRANCH := master -FRAMEWORK_VENDOR_FOLDER := $(CURDIR)/vendor/ -FRAMEWORK_VENDOR_BRANCH := master - FRAMEWORK_OFFLINE_BUILD := "" ifneq "$(OFFLINE_BUILD)" "" FRAMEWORK_OFFLINE_BUILD := $(OFFLINE_BUILD) @@ -85,11 +91,15 @@ build-win: build-linux: GOOS=linux GOARCH=amd64 $(GOBUILD) -o bin/$(APP_NAME)-linux64 GOOS=linux GOARCH=386 $(GOBUILD) -o bin/$(APP_NAME)-linux32 + +build-arm: GOOS=linux GOARCH=arm GOARM=5 $(GOBUILD) -o bin/$(APP_NAME)-armv5 + # for Raspberry Pi + #env GOOS=linux GOARCH=arm GOARM=5 go build build-darwin: GOOS=darwin GOARCH=amd64 $(GOBUILD) -o bin/$(APP_NAME)-darwin64 - GOOS=darwin GOARCH=386 $(GOBUILD) -o bin/$(APP_NAME)-darwin32 + #GOOS=darwin GOARCH=386 $(GOBUILD) -o bin/$(APP_NAME)-darwin32 build-bsd: GOOS=freebsd GOARCH=amd64 $(GOBUILD) -o bin/$(APP_NAME)-freebsd64 @@ -121,10 +131,11 @@ init: @echo building $(APP_NAME) $(APP_VERSION) @echo $(CURDIR) @mkdir -p $(INFINI_BASE_FOLDER) - @if [ ! -d $(FRAMEWORK_FOLDER) ]; then echo "framework does not exist";(cd $(INFINI_BASE_FOLDER)&&git clone -b $(FRAMEWORK_BRANCH) ssh://git@git.infini.ltd:64221/infini/framework.git) fi - @if [ ! -d $(FRAMEWORK_VENDOR_FOLDER) ]; then echo "framework vendor does not exist";(git clone -b $(FRAMEWORK_VENDOR_BRANCH) ssh://git@git.infini.ltd:64221/infini/framework-vendor.git vendor) fi + @echo "framework path: " $(FRAMEWORK_FOLDER) + @if [ ! -d $(FRAMEWORK_FOLDER) ]; then echo "framework does not exist";(cd $(INFINI_BASE_FOLDER)&&git clone -b $(FRAMEWORK_BRANCH) $(FRAMEWORK_REPO) framework ) fi + @if [ ! -d $(FRAMEWORK_VENDOR_FOLDER) ]; then echo "framework vendor does not exist";(git clone -b $(FRAMEWORK_VENDOR_BRANCH) $(FRAMEWORK_VENDOR_REPO) vendor) fi @if [ "" == $(FRAMEWORK_OFFLINE_BUILD) ]; then (cd $(FRAMEWORK_FOLDER) && git pull origin $(FRAMEWORK_BRANCH)); fi; - @if [ "" == $(FRAMEWORK_OFFLINE_BUILD) ]; then (cd vendor && git pull origin $(FRAMEWORK_VENDOR_BRANCH)); fi; + @if [ "" == $(FRAMEWORK_OFFLINE_BUILD) ]; then (cd $(FRAMEWORK_VENDOR_FOLDER) && git pull origin $(FRAMEWORK_VENDOR_BRANCH)); fi; update-generated-file: @echo "update generated info" @@ -139,15 +150,10 @@ restore-generated-file: update-vfs: - cd $(FRAMEWORK_FOLDER) && cd cmd/vfs && go build && cp vfs ~/ - @if [ -d $(APP_STATIC_FOLDER) ]; then echo "generate static files";(cd $(APP_STATIC_FOLDER) && ~/vfs -ignore="static.go|.DS_Store" -o static.go -pkg public . ) fi + cd $(FRAMEWORK_FOLDER) && cd cmd/vfs && $(GO) build && cp vfs ~/ + @if [ -d $(APP_STATIC_FOLDER) ]; then echo "generate static files";(cd $(APP_STATIC_FOLDER) && ~/vfs -ignore="static.go|.DS_Store" -o static.go -pkg $(APP_STATIC_PACKAGE) . ) fi -update-template-ui: - @if [ -d $(APP_UI_FOLDER) ]; then (echo "generate main UI pages";$(GO) get infini.sh/ego/cmd/ego;cd $(APP_UI_FOLDER)/ && ego) fi - @if [ -d $(APP_PLUGIN_FOLDER) ]; then (echo "generate plugin UI pages";$(GO) get infini.sh/ego/cmd/ego;cd $(APP_PLUGIN_FOLDER)/ && ego) fi - -#config: init update-vfs update-template-ui -config: init update-vfs update-template-ui update-generated-file +config: init update-vfs update-generated-file @echo "update configs" @# $(GO) env @mkdir -p bin @@ -179,7 +185,7 @@ package-all-platform: package-darwin-platform package-linux-platform package-win package-darwin-platform: @echo "Packaging Darwin" cd bin && tar cfz ../bin/darwin64.tar.gz $(APP_NAME)-darwin64 $(APP_CONFIG) - cd bin && tar cfz ../bin/darwin32.tar.gz $(APP_NAME)-darwin32 $(APP_CONFIG) + #cd bin && tar cfz ../bin/darwin32.tar.gz $(APP_NAME)-darwin32 $(APP_CONFIG) package-linux-platform: @echo "Packaging Linux" diff --git a/README.md b/README.md index 086b7a3a..d8689420 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ cnpm run docker:dev #### 手动更新开发镜像 ``` +docker login -u infini -p ltd docker.infini.ltd:64443 docker pull docker.infini.ltd:64443/nodejs-dev:latest ``` diff --git a/build.bat b/build.bat index d1571dfa..4afa084b 100644 --- a/build.bat +++ b/build.bat @@ -1,2 +1,2 @@ set GOPATH=%CD%;%CD%/vendor;%GOPATH% -go build +go build -w -s diff --git a/web/.dockerignore b/web/.dockerignore new file mode 100644 index 00000000..2766e197 --- /dev/null +++ b/web/.dockerignore @@ -0,0 +1,5 @@ +.temp +.git +*.swp +node_modules/ +.github/ \ No newline at end of file diff --git a/web/config/config.js b/web/config/config.js index abd01ba9..a225972e 100644 --- a/web/config/config.js +++ b/web/config/config.js @@ -31,7 +31,7 @@ export default { include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], exclude: ['@babel/runtime'], }, - hardSource: true, + hardSource: false, } : {}), }, diff --git a/web/package.json b/web/package.json index 4a90b9f0..6eaf6ece 100644 --- a/web/package.json +++ b/web/package.json @@ -2,28 +2,25 @@ "name": "logging-center", "version": "1.0.0", "description": "极限日志分析中心,致力于简单易用。", - "private": true, "dependencies": { "@ant-design/icons": "^4.0.0", "@antv/data-set": "^0.9.6", "@babel/runtime": "^7.1.2", "antd": "^3.10.0", - "antd-pro-merge-less": "^0.1.0", "antd-table-infinity": "^1.1.6", "bizcharts": "^3.2.2", "bizcharts-plugin-slider": "^2.0.3", "classnames": "^2.2.6", + "cluster": "^0.7.7", + "console": "^0.7.2", + "dns": "^0.2.2", "dva": "^2.4.0", - "egg": "^2.4.1", - "egg-scripts": "^2.5.1", - "egg-validate": "^2.0.2", - "egg-view-assets": "^1.0.0", - "egg-view-nunjucks": "^2.2.0", "enquire-js": "^0.2.1", "hash.js": "^1.1.5", "lodash": "^4.17.10", "lodash-decorators": "^6.0.0", "memoize-one": "^4.0.0", + "module": "^1.2.5", "moment": "^2.22.2", "node-ssh": "^8.0.0", "numeral": "^2.0.6", @@ -42,13 +39,14 @@ "react-highlight-words": "^0.16.0", "react-json-view": "^1.19.1", "react-router-dom": "^4.3.1", - "react-sparklines": "^1.7.0" + "react-sparklines": "^1.7.0", + "repl": "^0.1.3" }, "devDependencies": { - "antd-pro-merge-less": "^0.1.0", "antd-theme-webpack-plugin": "^1.1.8", "autod": "^3.0.1", "autod-egg": "^1.1.0", + "antd-pro-merge-less": "^0.1.0", "babel-eslint": "^8.1.2", "babel-plugin-dva-hmr": "^0.4.1", "babel-plugin-import": "^1.6.3", @@ -71,7 +69,12 @@ "redbox-react": "^1.5.0", "umi": "^2.1.2", "umi-plugin-ga": "^1.1.3", - "umi-plugin-react": "^1.1.1" + "umi-plugin-react": "^1.1.1", + "egg": "^2.4.1", + "egg-scripts": "^2.5.1", + "egg-validate": "^2.0.2", + "egg-view-assets": "^1.6.1", + "egg-view-nunjucks": "^2.2.0" }, "engines": { "node": ">=8.9.0"