lib_um_crypto_rust/build.sh
鲁树人 cd57e88666
All checks were successful
continuous-integration/drone/push Build is passing
CI: Build and publish (#7)
Reviewed-on: #7
Co-authored-by: 鲁树人 <lu.shuren@um-react.app>
Co-committed-by: 鲁树人 <lu.shuren@um-react.app>
2024-09-24 21:31:18 +00:00

36 lines
983 B
Bash
Executable File

#!/bin/bash -ex
docker volume create umc_rust_cache
docker volume create umc_rust_pnpm_cache
docker volume create umc_rust_target_cache
docker volume create umc_pnpm_loader_cache
docker buildx build --build-arg uid="$(id -u)" --build-arg gid="$(id -g)" -t umc_rust .
run_container() {
docker run -d \
-v umc_rust_cache:/h/.cargo \
-v "${PWD}:/a" \
-v umc_rust_pnpm_cache:/a/.pnpm-store \
-v umc_rust_target_cache:/a/target \
-v umc_pnpm_loader_cache:/a/um_wasm_loader/node_modules \
umc_rust
}
umc_rust_id="$(run_container)"
docker exec -i -u root "${umc_rust_id}" chown "$(id -u):$(id -g)" \
/h/.cargo \
/a/.pnpm-store \
/a/target \
/a/um_wasm_loader/node_modules
docker exec -i "${umc_rust_id}" bash <<'EOF'
export npm_config_use_node_version=22.9.0
cd um_wasm_loader
pnpm --package-import-method=copy i
pnpm build
pnpm pack
EOF
docker stop "${umc_rust_id}"
docker rm -f "${umc_rust_id}"