-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdocker-yocto-cmd
executable file
·48 lines (40 loc) · 1.19 KB
/
docker-yocto-cmd
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
#!/bin/bash
build_bundle=$(realpath $(dirname $0)/..)
docker_image="crops/poky:ubuntu-16.04"
if [ -e $build_bundle/docker-image ]; then
docker_image=$(cat $build_bundle/docker-image)
fi
# Pass in SSH agent
if [ -n "$SSH_AUTH_SOCK" ]; then
SSH_AUTH_VOLUME="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK"
fi
# Check if we're being run interactively
if tty -s; then
TTY_FLAGS="-ti"
fi
if [ -z "$BUILDDIR" ]; then
echo "BUILDDIR is not set; source init-build-env first" >&2
exit 1
fi
if [ -e ~/.docker-bitbake.dirs ]; then
while read -r line; do
mkdir -p $line
USER_VOLUMES="$USER_VOLUMES -v $line:$line"
done < ~/.docker-bitbake.dirs
fi
cd $BUILDDIR
# Expose the entire build-bundle, the user's home (read-only) and pass SSH into the container
docker pull "$docker_image"
exec docker run --rm \
$TTY_FLAGS \
-v /tmp:/tmp \
-v $build_bundle:$build_bundle \
-v $HOME:$HOME:ro \
$USER_VOLUMES \
$SSH_AUTH_VOLUME \
$DOCKER_BITBAKE_EXTRA_ARGS \
-e DISPLAY=$DISPLAY \
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
"$docker_image" \
--workdir=$build_bundle \
--cmd="$build_bundle/jenkins-yocto-tools/docker-yocto-internal $BUILDDIR $HOME $USER $*"