OXYGENHUB
# 0077c7488e5d oxygenflow / images / rust / build.sh
1.6 KiB · Bourne Again Shell (bash) · executable · last changed Prebuilt dependencies for oxygen and oxygenflow too 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
13
rm -rf "$here/vendor"
14
cargo vendor --locked --versioned-dirs \
15
    --manifest-path "$dev/oxygen/Cargo.toml" \
16
    --sync "$dev/oxygenhub/Cargo.toml" \
17
    --sync "$dev/oxygenflow/Cargo.toml" \
18
    "$here/vendor" >/dev/null
19
# npm packages of the two extensions, into a cache `npm ci --offline` reads.
20
rm -rf "${here:?}/npm-cache"
21
for e in oxygen-vscode oxygenhub-vscode; do
22
    tmp=$(mktemp -d)
23
    cp "$dev/$e/package.json" "$dev/$e/package-lock.json" "$tmp/"
24
    (cd "$tmp" && npm ci --cache "$here/npm-cache" --ignore-scripts --no-audit --no-fund >/dev/null)
25
    rm -rf "${tmp:?}"
26
done
27
rm -rf "${here:?}/npm-cache/_logs"
28
# Dependency recipes of the workspaces whose dependencies the image
29
# prebuilds (see the Dockerfile).
30
rm -rf "${here:?}/warm"
31
for ws in oxygenhub oxygen oxygenflow; do
32
    python3 "$here/recipe.py" "$dev/$ws" "$here/warm/$ws"
33
done
34
docker build -q -t oxygenflow-build \
35
    --build-arg NODE_VERSION=$NODE_VERSION --build-arg NODE_SHA256=$NODE_SHA256 "$here"
36
id=$(docker create oxygenflow-build)
37
docker export "$id" -o "$out"
38
docker rm "$id" >/dev/null
39
rm -rf "${here:?}/vendor" "${here:?}/npm-cache" "${here:?}/warm"
40
echo "$out"