OXYGENHUB
# f4dfd742b30d oxygenflow / images / rust / build.sh
1.8 KiB · Bourne Again Shell (bash) · executable · last changed The build image cross-builds releases; pinned d2d24c22 1 month ago source blame history raw
1
#!/bin/sh
2
# Build the OxygenFlow build image and write it as a root file system
3
# tarball for `flow rootfs import`. Run from any directory; the Oxygen
4
# projects are expected next to this repository (../oxygen, ../oxygenhub).
5
# Rebuild whenever a Cargo.lock or package-lock.json of those projects changes.
6
set -eu
7
here=$(cd "$(dirname "$0")" && pwd)
8
dev=$(cd "$here/../../.." && pwd)
9
out=${1:-$here/oxygenflow-build.tar}
10
NODE_VERSION=24.21.0
11
NODE_SHA256=fd8e59d5a511510f6a298afb548f18c7d2b1be404d8b4a27d94fbe49f56cb2d6
12
ZIG_VERSION=0.16.0
13
ZIG_SHA256=70e49664a74374b48b51e6f3fdfbf437f6395d42509050588bd49abe52ba3d00
14
15
rm -rf "$here/vendor"
16
cargo vendor --locked --versioned-dirs \
17
    --manifest-path "$dev/oxygen/Cargo.toml" \
18
    --sync "$dev/oxygenhub/Cargo.toml" \
19
    --sync "$dev/oxygenflow/Cargo.toml" \
20
    "$here/vendor" >/dev/null
21
# npm packages of the two extensions, into a cache `npm ci --offline` reads.
22
rm -rf "${here:?}/npm-cache"
23
for e in oxygen-vscode oxygenhub-vscode; do
24
    tmp=$(mktemp -d)
25
    cp "$dev/$e/package.json" "$dev/$e/package-lock.json" "$tmp/"
26
    (cd "$tmp" && npm ci --cache "$here/npm-cache" --ignore-scripts --no-audit --no-fund >/dev/null)
27
    rm -rf "${tmp:?}"
28
done
29
rm -rf "${here:?}/npm-cache/_logs"
30
# Dependency recipes of the workspaces whose dependencies the image
31
# prebuilds (see the Dockerfile).
32
rm -rf "${here:?}/warm"
33
for ws in oxygenhub oxygen oxygenflow; do
34
    python3 "$here/recipe.py" "$dev/$ws" "$here/warm/$ws"
35
done
36
docker build -q -t oxygenflow-build \
37
    --build-arg NODE_VERSION=$NODE_VERSION --build-arg NODE_SHA256=$NODE_SHA256 \
38
    --build-arg ZIG_VERSION=$ZIG_VERSION --build-arg ZIG_SHA256=$ZIG_SHA256 "$here"
39
id=$(docker create oxygenflow-build)
40
docker export "$id" -o "$out"
41
docker rm "$id" >/dev/null
42
rm -rf "${here:?}/vendor" "${here:?}/npm-cache" "${here:?}/warm"
43
echo "$out"