mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-02 05:40:27 +08:00
改进编译脚本
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
function build() {
|
||||
ROOT=$(dirname $0)
|
||||
NAME="edge-api"
|
||||
DIST="../dist/${NAME}"
|
||||
DIST=$ROOT/"../dist/${NAME}"
|
||||
OS=${1}
|
||||
ARCH=${2}
|
||||
|
||||
@@ -16,16 +16,30 @@ function build() {
|
||||
exit
|
||||
fi
|
||||
|
||||
VERSION_DATA=$(cat ../internal/const/const.go)
|
||||
re="Version[ ]+=[ ]+\"([0-9.]+)\""
|
||||
if [[ $VERSION_DATA =~ $re ]]; then
|
||||
VERSION=${BASH_REMATCH[1]}
|
||||
else
|
||||
echo "could not match version"
|
||||
VERSION=$(lookup-version $ROOT/../internal/const/const.go)
|
||||
ZIP="${NAME}-${OS}-${ARCH}-v${VERSION}.zip"
|
||||
|
||||
# check edge-node
|
||||
NodeVersion=$(lookup-version $ROOT"/../../EdgeNode/internal/const/const.go")
|
||||
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
|
||||
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
|
||||
echo "copying ..."
|
||||
@@ -35,10 +49,11 @@ function build() {
|
||||
mkdir $DIST/configs
|
||||
mkdir $DIST/logs
|
||||
fi
|
||||
cp configs/api.template.yaml $DIST/configs/
|
||||
cp configs/db.template.yaml $DIST/configs/
|
||||
cp -R deploy $DIST/
|
||||
cp -R installers $DIST/
|
||||
cp $ROOT/configs/api.template.yaml $DIST/configs/
|
||||
cp $ROOT/configs/db.template.yaml $DIST/configs/
|
||||
cp -R $ROOT/deploy $DIST/
|
||||
rm -f $dist/deploy/.gitignore
|
||||
cp -R $ROOT/installers $DIST/
|
||||
|
||||
# building installer
|
||||
echo "building installer ..."
|
||||
@@ -63,4 +78,17 @@ function build() {
|
||||
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
|
||||
|
||||
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