demo-ui/deploy.sh

19 lines
605 B
Bash
Raw Permalink Normal View History

2025-02-21 09:14:45 +08:00
run() {
echo "[RUN] " $*
$*
if [ $? -ne 0 ]; then
echo "[ERROR] fail"
exit 1
fi
}
run npm run pre
run npm run build
HUB=registry.cn-hangzhou.aliyuncs.com/rsjst
NAME=$(cat package.json | grep "name" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g' | sed 's/ //g' | sed 's/,//g' | sed 's/"//g')
VERSION=$(cat package.json | grep "version" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g' | sed 's/ //g' | sed 's/,//g' | sed 's/"//g')
run docker buildx build -t $HUB/$NAME:$VERSION --platform=linux/amd64,linux/arm64 -f ./docker/Dockerfile . --push
run echo build and push $HUB/$NAME:$VERSION success