-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-locally.sh
executable file
·56 lines (44 loc) · 1.52 KB
/
build-locally.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e
MY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source-path=SCRIPTDIR
. "$MY_DIR"/scripts/_utils.sh
. "$MY_DIR"/_functions.sh
# keep the image tag synced with GHA
BUILDER_IMAGE_TAG="ghcr.io/loongson-community/dotnet-unofficial-build-builder:20241120T105715Z"
main() {
cd "$MY_DIR"
mkdir -p out tmp/ccache tmp/rootfs tmp/rootfs-musl tmp/vmr
# provision the rootfs outside of Docker in order to avoid DinD operation
local rootfs_glibc_image_tag
local rootfs_musl_image_tag
rootfs_glibc_image_tag="$(cat "$MY_DIR"/rootfs-glibc-image-tag.txt)"
rootfs_musl_image_tag="$(cat "$MY_DIR"/rootfs-musl-image-tag.txt)"
provision_loong_rootfs "$rootfs_glibc_image_tag" tmp/rootfs sudo
provision_loong_rootfs "$rootfs_musl_image_tag" tmp/rootfs-musl sudo
local args=(
--rm
--platform linux/amd64
-v "$MY_DIR":/work
-v "$MY_DIR"/tmp/ccache:/tmp/ccache
-v "$MY_DIR"/out:/tmp/out
-v "$MY_DIR"/tmp/rootfs:/tmp/rootfs
-v "$MY_DIR"/tmp/rootfs-musl:/tmp/rootfs-musl
-v "$MY_DIR"/tmp/vmr:/vmr
-e ALSO_FINALIZE=true
-e CI=true
# keep in line with GHA definitions for consistency
-e BUILD_CONFIG=_config.ci.sh
-e CCACHE_DIR=/tmp/ccache
-e OUT_DIR=/tmp/out
-e ROOTFS_GLIBC_DIR=/tmp/rootfs
-e ROOTFS_MUSL_DIR=/tmp/rootfs-musl
--init
-u b
-w /work
"$BUILDER_IMAGE_TAG"
./build.sh
)
exec docker run "${args[@]}"
}
main