Allow symlinks in the container build

This patch permits symlinks in the docker build.  Normally docker
does not permit symlinked files in the build context sent to the
docker server.  To work around this problem, a secure directory
is created in /tmp and the container contents are copied to that
directory.  Any symlinks are turned into their non-symlinked
equivalents.

Change-Id: I38cd5aeed4c73b90449354a0979fc6ddf7891ccb
Implements-blueprint: linked-build
This commit is contained in:
Steven Dake 2015-02-12 15:49:57 -07:00
parent ddc12789bc
commit 1078eddf11

View File

@ -88,10 +88,14 @@ if [ "$MODE" = "release" ]; then
echo
fi
if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $IMGDIR; then
TMPDIR=$(mktemp -d /tmp/output.XXXXXXXXXX)
cp -aL $IMGDIR/* $TMPDIR
if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then
echo "ERROR: failed to build $FULLIMAGE"
exit 1
fi
rm -rf $TMPDIR
echo "Built: $FULLIMAGE"