forked from bytecodealliance/lucet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevenv_build_container.sh
executable file
·57 lines (44 loc) · 1.71 KB
/
devenv_build_container.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
57
#!/bin/sh
set -e
. "$(dirname ${BASH_SOURCE:-$0})/config.inc"
git submodule update --init 2>/dev/null ||:
if docker image inspect lucet-dev:latest > /dev/null; then
if [ -z "$DEVENV_FORCE_REBUILD" ]; then
echo "A lucet-dev image is already present"
echo "Hit Ctrl-C right now if you don't want to rebuild it"
echo "or skip this wait by setting the DEVENV_FORCE_REBUILD variable"
sleep 30
fi
fi
echo "Building lucet-dev:latest"
docker build -t lucet-dev:latest .
docker tag lucet-dev:latest lucet:latest
if [ ! -z "$DEVENV_SKIP_LUCET_BUILD" ]; then
echo "Done"
exit 0
fi
if docker image inspect lucet:latest > /dev/null; then
if [ -z "$DEVENV_FORCE_REBUILD" ]; then
echo "A lucet image is already present"
echo "Hit Ctrl-C right now if you don't want to rebuild it"
echo "or skip this wait by setting the DEVENV_FORCE_REBUILD variable"
sleep 30
fi
fi
echo "Now creating lucet:latest on top of lucet-dev:latest"
docker run --name=lucet-dev --detach --mount type=bind,src="$(cd $(dirname ${0}); pwd),target=/lucet" \
lucet-dev:latest /bin/sleep 99999999 > /dev/null
echo "Building and installing optimized files in [$HOST_LUCET_MOUNT_POINT]"
if [ -z "$UNOPTIMIZED_BUILD" ]; then
docker exec -t -w "$HOST_LUCET_MOUNT_POINT" lucet-dev make install
else
docker exec -t -w "$HOST_LUCET_MOUNT_POINT" lucet-dev make install-dev
fi
echo "Cleaning"
docker exec -t -w "$HOST_LUCET_MOUNT_POINT" lucet-dev make clean
echo "Tagging the new image"
docker container commit lucet-dev lucet:latest
echo "Cleaning"
docker kill lucet-dev
docker rm lucet-dev
echo "Done"