Dockerfile 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. FROM ubuntu:14.04 as toolchain
  2. ENV OSX_SDK_URL=https://s3.dockerproject.org/darwin/v2/ \
  3. OSX_SDK=MacOSX10.10.sdk \
  4. OSX_MIN=10.10 \
  5. CTNG=1.23.0
  6. # FIRST PART
  7. # build osx64 toolchain (stripped of man documentation)
  8. # the toolchain produced is not self contained, it needs clang at runtime
  9. #
  10. # SECOND PART
  11. # build gcc (no g++) centos6-x64 toolchain
  12. # doc: https://crosstool-ng.github.io/docs/
  13. # apt-get should be all dep to build toolchain
  14. # sed and 1st echo are for convenience to get the toolchain in /tmp/x86_64-centos6-linux-gnu
  15. # other echo are to enable build by root (crosstool-NG refuse to do that by default)
  16. # the last 2 rm are just to save some time and space writing docker layers
  17. #
  18. # THIRD PART
  19. # build fpm and creates a set of deb from gem
  20. # ruby2.0 depends on ruby1.9.3 which is install as default ruby
  21. # rm/ln are here to change that
  22. # created deb depends on rubygem-json but json gem is not build
  23. # so do by hand
  24. # might wanna make sure osx cross and the other tarball as well as the packages ends up somewhere other than tmp
  25. # might also wanna put them as their own layer to not have to unpack them every time?
  26. RUN apt-get update && \
  27. apt-get install -y \
  28. clang-3.8 patch libxml2-dev \
  29. ca-certificates \
  30. curl \
  31. git \
  32. make \
  33. xz-utils && \
  34. git clone https://github.com/tpoechtrager/osxcross.git /tmp/osxcross && \
  35. curl -L ${OSX_SDK_URL}/${OSX_SDK}.tar.xz -o /tmp/osxcross/tarballs/${OSX_SDK}.tar.xz && \
  36. ln -s /usr/bin/clang-3.8 /usr/bin/clang && \
  37. ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ && \
  38. ln -s /usr/bin/llvm-dsymutil-3.8 /usr/bin/dsymutil && \
  39. UNATTENDED=yes OSX_VERSION_MIN=${OSX_MIN} /tmp/osxcross/build.sh && \
  40. rm -rf /tmp/osxcross/target/SDK/${OSX_SDK}/usr/share && \
  41. cd /tmp && \
  42. tar cfJ osxcross.tar.xz osxcross/target && \
  43. rm -rf /tmp/osxcross && \
  44. apt-get install -y \
  45. bison curl flex gawk gcc g++ gperf help2man libncurses5-dev make patch python-dev texinfo xz-utils && \
  46. curl -L http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${CTNG}.tar.xz \
  47. | tar -xJ -C /tmp/ && \
  48. cd /tmp/crosstool-ng-${CTNG} && \
  49. ./configure --enable-local && \
  50. make && \
  51. ./ct-ng x86_64-centos6-linux-gnu && \
  52. sed -i '/CT_PREFIX_DIR=/d' .config && \
  53. echo 'CT_PREFIX_DIR="/tmp/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"' >> .config && \
  54. echo 'CT_EXPERIMENTAL=y' >> .config && \
  55. echo 'CT_ALLOW_BUILD_AS_ROOT=y' >> .config && \
  56. echo 'CT_ALLOW_BUILD_AS_ROOT_SURE=y' >> .config && \
  57. ./ct-ng build && \
  58. cd /tmp && \
  59. rm /tmp/x86_64-centos6-linux-gnu/build.log.bz2 && \
  60. tar cfJ x86_64-centos6-linux-gnu.tar.xz x86_64-centos6-linux-gnu/ && \
  61. rm -rf /tmp/x86_64-centos6-linux-gnu/ && \
  62. rm -rf /tmp/crosstool-ng-${CTNG}
  63. # base image to crossbuild grafana
  64. FROM ubuntu:14.04
  65. ENV GOVERSION=1.11.5 \
  66. PATH=/usr/local/go/bin:$PATH \
  67. GOPATH=/go \
  68. NODEVERSION=10.14.2
  69. COPY --from=toolchain /tmp/x86_64-centos6-linux-gnu.tar.xz /tmp/
  70. COPY --from=toolchain /tmp/osxcross.tar.xz /tmp/
  71. RUN apt-get update && \
  72. apt-get install -y \
  73. clang-3.8 gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-mingw-w64-x86-64 \
  74. apt-transport-https \
  75. ca-certificates \
  76. curl \
  77. libfontconfig1 \
  78. gcc \
  79. g++ \
  80. git \
  81. make \
  82. rpm \
  83. xz-utils \
  84. expect \
  85. gnupg2 \
  86. unzip && \
  87. ln -s /usr/bin/clang-3.8 /usr/bin/clang && \
  88. ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ && \
  89. ln -s /usr/bin/llvm-dsymutil-3.8 /usr/bin/dsymutil && \
  90. curl -L https://nodejs.org/dist/v${NODEVERSION}/node-v${NODEVERSION}-linux-x64.tar.xz \
  91. | tar -xJ --strip-components=1 -C /usr/local && \
  92. curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
  93. echo "deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main" \
  94. | tee /etc/apt/sources.list.d/yarn.list && \
  95. apt-get update && apt-get install --no-install-recommends yarn && \
  96. curl -L https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz \
  97. | tar -xz -C /usr/local && \
  98. git clone https://github.com/raspberrypi/tools.git /opt/rpi-tools --depth=1
  99. RUN apt-get install -y \
  100. gcc libc-dev make && \
  101. gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
  102. curl -sSL https://get.rvm.io | bash -s stable && \
  103. /bin/bash -l -c "rvm requirements && rvm install 2.2 && gem install -N fpm"
  104. ADD ./bootstrap.sh /tmp/bootstrap.sh