run-in-docker 797 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. set -eu
  3. echo $(pwd)
  4. cat >Dockerfile <<EOF
  5. FROM debian:sid
  6. ENV DEBIAN_FRONTEND=noninteractive
  7. RUN echo "deb http://ftp.de.debian.org/debian sid main" > /etc/apt/sources.list
  8. RUN apt-get update && apt-get dist-upgrade --yes
  9. RUN apt-get install -y --no-install-recommends build-essential adduser
  10. RUN adduser gbp --disabled-password --gecos='gbp docker test user' --shell=/bin/bash --home /git-buildpackage
  11. WORKDIR /git-buildpackage
  12. COPY . .
  13. RUN chown -R gbp: .
  14. RUN apt-get -y build-dep .
  15. # Run as non root so permision tests pass
  16. CMD su -c "make all+net" gbp
  17. EOF
  18. CIDFILE="$(mktemp --dry-run)"
  19. TAG="git-buildpackage/sid"
  20. echo "Building Docker image ${TAG}"
  21. docker build . --tag=${TAG}
  22. docker run --cidfile=${CIDFILE} ${TAG}
  23. docker rm "$(cat ${CIDFILE})" >/dev/null
  24. rm -f "${CIDFILE}"