docker-build.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # (c) 2014-2016 Freifunk Hochstift <kontakt@hochstift.freifunk.net>
  3. # check if we're in the container
  4. running_in_docker() {
  5. awk -F/ '$2 == "docker"' /proc/self/cgroup | read
  6. }
  7. # when called within the container, just call build.sh after ensuring git config is set
  8. if [ running_in_docker -a "$(id -un)" == "build" ]; then
  9. # ensure that we have a valid git config
  10. git config --global user.name "docker-based build"
  11. git config --global user.email build@hochstift.freifunk.net
  12. # invoke the actual build
  13. ./build.sh $@
  14. exit
  15. fi
  16. MYDIR="$(dirname $0)"
  17. MYDIR="$(readlink -f ${MYDIR})"
  18. pushd "${MYDIR}" > /dev/null
  19. # run the container with fixed hostname and mapped /code directory
  20. docker run -ti -h ffho-build -v "${MYDIR}:/code" \
  21. --env BASE="${BASE}" \
  22. --env BRANCH="${BRANCH}" \
  23. --env VERSION="${VERSION}" \
  24. --env AUTOUPDATER="${AUTOUPDATER}" \
  25. --env BROKEN="${BROKEN}" \
  26. --env BUILD_TS="${BUILD_TS}" \
  27. --env DIRCLEAN="${DIRCLEAN}" \
  28. --env FAKETIME_LIB="/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1" \
  29. --env KEY_DIR="${KEY_DIR}" \
  30. --env MAKEJOBS="${MAKEJOBS}" \
  31. --env NO_FAKETIME="${NO_FAKETIME}" \
  32. --env PRIORITY="${PRIORITY}" \
  33. --env SITE_ID="${SITE_ID}" \
  34. --env TARGETS="${TARGETS}" \
  35. --env VERBOSE="${VERBOSE}" \
  36. ffpb/build
  37. popd > /dev/null #${MYDIR}