mirror of https://gerrit.osmocom.org/osmo-dev
Replace the previous approach of building outside of docker and mounting everything inside docker while running tests, with also building everything inside docker. This prevents incompatibilities between host system and docker (e.g. different glibc). As nice side-effect, /usr/local is not filled up anymore. Change-Id: Ib6db8ffd916c788c9de0b3d51c82e1d7bb3f6828changes/90/25190/2
parent
c47eafbe0a
commit
0fa204e179
@ -0,0 +1,38 @@
|
||||
#!/bin/sh -ex
|
||||
# Passed by ttcn3.sh to gen_makefile.py to run './configure', 'make' and
|
||||
# 'make install' inside docker. The osmo-dev directory is mounted at the same
|
||||
# location inside the docker container. A usr_local dir is mounted to
|
||||
# /usr/local, so 'make install' can put all files there and following builds
|
||||
# have the files available.
|
||||
DIR_OSMODEV="$(readlink -f "$(dirname $0)/../..")"
|
||||
DIR_MAKE="$DIR_OSMODEV/ttcn3/make"
|
||||
DIR_USR_LOCAL="$DIR_OSMODEV/ttcn3/usr_local"
|
||||
RUN_SCRIPT="$DIR_OSMODEV/ttcn3/.run.sh"
|
||||
DOCKER_IMG="$1"
|
||||
UID="$(id -u)"
|
||||
shift
|
||||
|
||||
mkdir -p "$DIR_MAKE"
|
||||
|
||||
# Script running as user inside docker
|
||||
echo "#!/bin/sh -ex" > "$RUN_SCRIPT"
|
||||
echo "cd \"$PWD\"" >> "$RUN_SCRIPT"
|
||||
for i in "$@"; do
|
||||
echo -n "'$i' " >> "$RUN_SCRIPT"
|
||||
done
|
||||
echo >> "$RUN_SCRIPT"
|
||||
chmod +x "$RUN_SCRIPT"
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
-e "LD_LIBRARY_PATH=/usr/local/lib" \
|
||||
-v "$DIR_OSMODEV:$DIR_OSMODEV" \
|
||||
-v "$DIR_USR_LOCAL:/usr/local" \
|
||||
-v "$RUN_SCRIPT:/tmp/run.sh:ro" \
|
||||
"$DOCKER_IMG" \
|
||||
sh -ex -c "
|
||||
if ! id -u $UID 2>/dev/null; then
|
||||
useradd -u $UID user
|
||||
fi
|
||||
su \$(id -un $UID) -c /tmp/run.sh
|
||||
"
|
Loading…
Reference in new issue