12345678910111213141516171819202122232425262728293031323334353637 |
- #!/bin/bash
- # check if we're in the container
- running_in_docker() {
- awk -F/ '$2 == "docker"' /proc/self/cgroup | read
- }
- # when called within the container, just call build.sh after ensuring git config is set
- if [ running_in_docker -a "$(id -un)" == "build" ]; then
- # ensure that we have a valid git config
- git config --global user.name "docker-based build"
- git config --global user.email build@paderborn.freifunk.net
- # invoke the actual build
- ./build.sh $@
- exit
- fi
- MYDIR="$(dirname $0)"
- MYDIR="$(readlink -f $MYDIR)"
- pushd "$MYDIR" > /dev/null
- # build the container (TODO: remove this, it should get pulled from the hub)
- docker build -t ffpb/build docker
- # run the container with fixed hostname and mapped /code directory
- docker run -ti -h ffpb-build -v "$MYDIR:/code" \
- --env BUILD_TS="$BUILD_TS" \
- --env BASE="$BASE" \
- --env BRANCH="$BRANCH" \
- --env VERBOSE="$VERBOSE" \
- --env VERSION="$VERSION" \
- ffpb/build
- popd > /dev/null
|