A lightweight mechanism to provide an *instant kickstart* to a Go web server instance upon changing any Go source files under the project directory (and its subdirectories).

Dockerfile 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. FROM ubuntu:16.04
  2. # Dependencies to get the git sources and go binaries
  3. RUN apt-get update && apt-get install -y \
  4. curl \
  5. git \
  6. && rm -rf /var/lib/apt/lists/*
  7. # Get the git sources. If not cached, this takes O(5 minutes).
  8. WORKDIR /git
  9. RUN git config --global advice.detachedHead false
  10. # Linux Kernel: Released 19 Feb 2017
  11. RUN git clone --branch v4.10 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
  12. # GNU C library: Released 05 Feb 2017 (we should try to get a secure way to clone this)
  13. RUN git clone --branch glibc-2.25 --depth 1 git://sourceware.org/git/glibc.git
  14. # Get Go 1.8 (https://github.com/docker-library/golang/blob/master/1.8/Dockerfile)
  15. ENV GOLANG_VERSION 1.8
  16. ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
  17. ENV GOLANG_DOWNLOAD_SHA256 53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca
  18. RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
  19. && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
  20. && tar -C /usr/local -xzf golang.tar.gz \
  21. && rm golang.tar.gz
  22. ENV PATH /usr/local/go/bin:$PATH
  23. # Linux and Glibc build dependencies
  24. RUN apt-get update && apt-get install -y \
  25. gawk make python \
  26. gcc gcc-multilib \
  27. gettext texinfo \
  28. && rm -rf /var/lib/apt/lists/*
  29. # Emulator and cross compilers
  30. RUN apt-get update && apt-get install -y \
  31. qemu \
  32. gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi \
  33. gcc-mips-linux-gnu gcc-mips64-linux-gnuabi64 \
  34. gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu \
  35. gcc-powerpc64-linux-gnu gcc-powerpc64le-linux-gnu \
  36. gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \
  37. && rm -rf /var/lib/apt/lists/*
  38. # Let the scripts know they are in the docker environment
  39. ENV GOLANG_SYS_BUILD docker
  40. WORKDIR /build
  41. ENTRYPOINT ["go", "run", "linux/mkall.go", "/git/linux", "/git/glibc"]