You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#!/usr/bin/env bash
# 在宿主机上:先打 amd64, 再在容器中打 arm64( 均支持自动发现项目) 。
set -euo pipefail
SCRIPT_DIR = " $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd ) "
REPO_ROOT = " $( cd " $SCRIPT_DIR /../.. " && pwd ) "
IMAGE_TAG = " ${ IMAGE_TAG :- tauri -linux-deb : 24 .04 } "
PROJECT_ARGS = ( " $@ " )
cd " $REPO_ROOT "
if ( ( ${# PROJECT_ARGS [@] } = = 0) ) ; then
mapfile -t SELECTED_PROJECTS < <( bash " $REPO_ROOT /scripts/build-linux-deb-all.sh " --list-projects)
else
SELECTED_PROJECTS = ( " ${ PROJECT_ARGS [@] } " )
fi
if ( ( ${# SELECTED_PROJECTS [@] } = = 0) ) ; then
echo "错误: 没有可构建项目" >& 2
exit 1
fi
echo " ==> host npm ci ( ${ SELECTED_PROJECTS [*] } ) "
for d in " ${ SELECTED_PROJECTS [@] } " ; do
if [ [ ! -f " $REPO_ROOT / $d /package.json " ] ] ; then
echo " 错误: 缺少 $REPO_ROOT / $d /package.json " >& 2
exit 1
fi
( cd " $REPO_ROOT / $d " && npm ci)
done
echo " ==> host build amd64 ( ${ SELECTED_PROJECTS [*] } ) "
bash " $REPO_ROOT /scripts/build-linux-deb-all.sh " --arch amd64 " ${ SELECTED_PROJECTS [@] } "
echo " ==> docker build --platform linux/amd64 -f scripts/docker/Dockerfile -t $IMAGE_TAG $REPO_ROOT "
docker build --platform linux/amd64 -f scripts/docker/Dockerfile -t " $IMAGE_TAG " " $REPO_ROOT "
echo "==> docker run (arm64: npm ci + build-linux-deb-all.sh)"
docker run --rm \
--platform linux/amd64 \
-v " $REPO_ROOT :/work " \
-w /work \
-e RUSTUP_HOME = /opt/rustup \
-e CARGO_HOME = /opt/cargo \
-e BUILD_ARCH = arm64 \
-e NPM_REGISTRY = " ${ NPM_REGISTRY :- https : //registry.npmjs.org/ } " \
" $IMAGE_TAG " \
bash /work/scripts/docker/container-entry.sh " ${ SELECTED_PROJECTS [@] } "