mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
改进编译脚本
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
function build() {
|
function build() {
|
||||||
ROOT=$(dirname $0)
|
ROOT=$(dirname $0)
|
||||||
NAME="edge-api"
|
NAME="edge-api"
|
||||||
DIST="../dist/${NAME}"
|
DIST=$ROOT/"../dist/${NAME}"
|
||||||
OS=${1}
|
OS=${1}
|
||||||
ARCH=${2}
|
ARCH=${2}
|
||||||
|
|
||||||
@@ -16,16 +16,30 @@ function build() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION_DATA=$(cat ../internal/const/const.go)
|
VERSION=$(lookup-version $ROOT/../internal/const/const.go)
|
||||||
re="Version[ ]+=[ ]+\"([0-9.]+)\""
|
ZIP="${NAME}-${OS}-${ARCH}-v${VERSION}.zip"
|
||||||
if [[ $VERSION_DATA =~ $re ]]; then
|
|
||||||
VERSION=${BASH_REMATCH[1]}
|
# check edge-node
|
||||||
else
|
NodeVersion=$(lookup-version $ROOT"/../../EdgeNode/internal/const/const.go")
|
||||||
echo "could not match version"
|
echo "building edge-node v${NodeVersion} ..."
|
||||||
|
EDGE_NODE_BUILD_SCRIPT=$ROOT"/../../EdgeNode/build/build.sh"
|
||||||
|
if [ ! -f $EDGE_NODE_BUILD_SCRIPT ]; then
|
||||||
|
echo "unable to find edge-node build script 'EdgeNode/build/build.sh'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
cd $ROOT"/../../EdgeNode/build"
|
||||||
|
echo "=============================="
|
||||||
|
architects=("amd64" "386")
|
||||||
|
for arch in "${architects[@]}"; do
|
||||||
|
./build.sh linux $arch
|
||||||
|
done
|
||||||
|
echo "=============================="
|
||||||
|
cd -
|
||||||
|
|
||||||
ZIP="${NAME}-${OS}-${ARCH}-v${VERSION}.zip"
|
rm -f $ROOT/deploy/*.zip
|
||||||
|
for arch in "${architects[@]}"; do
|
||||||
|
cp $ROOT"/../../EdgeNode/dist/edge-node-linux-${arch}-v${NodeVersion}.zip" $ROOT/deploy/
|
||||||
|
done
|
||||||
|
|
||||||
# copy files
|
# copy files
|
||||||
echo "copying ..."
|
echo "copying ..."
|
||||||
@@ -35,10 +49,11 @@ function build() {
|
|||||||
mkdir $DIST/configs
|
mkdir $DIST/configs
|
||||||
mkdir $DIST/logs
|
mkdir $DIST/logs
|
||||||
fi
|
fi
|
||||||
cp configs/api.template.yaml $DIST/configs/
|
cp $ROOT/configs/api.template.yaml $DIST/configs/
|
||||||
cp configs/db.template.yaml $DIST/configs/
|
cp $ROOT/configs/db.template.yaml $DIST/configs/
|
||||||
cp -R deploy $DIST/
|
cp -R $ROOT/deploy $DIST/
|
||||||
cp -R installers $DIST/
|
rm -f $dist/deploy/.gitignore
|
||||||
|
cp -R $ROOT/installers $DIST/
|
||||||
|
|
||||||
# building installer
|
# building installer
|
||||||
echo "building installer ..."
|
echo "building installer ..."
|
||||||
@@ -63,4 +78,17 @@ function build() {
|
|||||||
echo "[done]"
|
echo "[done]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lookup-version() {
|
||||||
|
FILE=$1
|
||||||
|
VERSION_DATA=$(cat $FILE)
|
||||||
|
re="Version[ ]+=[ ]+\"([0-9.]+)\""
|
||||||
|
if [[ $VERSION_DATA =~ $re ]]; then
|
||||||
|
VERSION=${BASH_REMATCH[1]}
|
||||||
|
echo $VERSION
|
||||||
|
else
|
||||||
|
echo "could not match version"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
build $1 $2
|
build $1 $2
|
||||||
|
|||||||
BIN
dist/edge-api/bin/edge-api
vendored
BIN
dist/edge-api/bin/edge-api
vendored
Binary file not shown.
2
dist/edge-api/configs/api.template.yaml
vendored
2
dist/edge-api/configs/api.template.yaml
vendored
@@ -1,2 +0,0 @@
|
|||||||
nodeId: "${nodeId}"
|
|
||||||
secret: "${secret}"
|
|
||||||
11
dist/edge-api/configs/db.template.yaml
vendored
11
dist/edge-api/configs/db.template.yaml
vendored
@@ -1,11 +0,0 @@
|
|||||||
default:
|
|
||||||
db: "prod"
|
|
||||||
prefix: ""
|
|
||||||
|
|
||||||
dbs:
|
|
||||||
prod:
|
|
||||||
driver: "mysql"
|
|
||||||
dsn: "root:123456@tcp(127.0.0.1:3306)/db_edge?charset=utf8mb4&timeout=30s"
|
|
||||||
prefix: "edge"
|
|
||||||
models:
|
|
||||||
package: internal/web/models
|
|
||||||
1
dist/edge-api/deploy/.gitignore
vendored
1
dist/edge-api/deploy/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
*.zip
|
|
||||||
1
dist/edge-api/installers/.gitignore
vendored
1
dist/edge-api/installers/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
installer-*
|
|
||||||
Reference in New Issue
Block a user