Cp: target is not a directory
This should work, add /
at the end of cp
command to make it clear for it that its dir:
mkdir -p /app/.apt
cp -R $BUILD_DIR/.apt/* /app/.apt/
There is no directory with the name 4.8...Thats your problem :)
Run this before your cp command:
mkdir -p /app/.apt/usr/lib/gcc/x86_64-linux-gnu/$GCC_VERSION
It creates all directories in the given path!