forked from terralang/terra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·32 lines (25 loc) · 971 Bytes
/
build.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
#!/bin/bash
set -e
IFS=- read distro release <<< "$1"
arch="$2"
llvm="$3"
lua="$4"
static="$5"
slib="$6"
cuda="$7"
variant="$8"
test="$9"
threads="${10}"
if [[ -n $arch ]]; then
export DOCKER_BUILDKIT=1
fi
docker build ${arch:+--platform=}$arch --build-arg release=$release --build-arg llvm=$llvm --build-arg lua=$lua --build-arg static=$static --build-arg slib=$slib --build-arg cuda=$cuda --build-arg variant=$variant --build-arg test=$test --build-arg threads=${threads:-4} -t terralang/terra:$distro-$release -f docker/Dockerfile.$distro .
# Copy files out of container and make release.
tmp=$(docker create terralang/terra:$distro-$release)
docker cp $tmp:/terra_install .
docker rm $tmp
arch_release=$(echo $arch | sed -e s/arm64/aarch64/)
RELEASE_NAME=terra-`uname | sed -e s/Darwin/OSX/`-${arch_release:-$(uname -m)}-`git rev-parse --short HEAD`
mv terra_install $RELEASE_NAME
tar cfJv $RELEASE_NAME.tar.xz $RELEASE_NAME
mv $RELEASE_NAME terra_install