-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·44 lines (39 loc) · 955 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
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -e
# basedir
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WORKINGDIR="$(pwd)"
CONTAINER_NAME="bootloader-isolinux"
# create environment
docker build \
-t ${CONTAINER_NAME} \
. \
&& {
echo "build environment ready"
} || {
echo "cannot create build environment"
exit 1
}
# container already exists ?
docker container rm ${CONTAINER_NAME}-env && {
echo "existing build environment removed"
} || {
echo "cannot remove build environment"
}
# create image
docker run \
--privileged=true \
--volume /dev:/dev \
--name ${CONTAINER_NAME}-env \
--mount type=bind,source="$(pwd)"/system,target=/mnt/system \
--mount type=bind,source="$(pwd)"/conf,target=/mnt/conf \
--mount type=bind,source="$(pwd)"/dist,target=/mnt/dist \
--tty \
--interactive \
${CONTAINER_NAME} \
&& {
echo "image created"
} || {
echo "ERROR: image creation failed"
exit 3
}