Dockerfile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. cmake \
  34. libssl-dev \
  35. xz-utils && \
  36. git clone https://github.com/tpoechtrager/osxcross.git /tmp/osxcross && \
  37. curl -L ${OSX_SDK_URL}/${OSX_SDK}.tar.xz -o /tmp/osxcross/tarballs/${OSX_SDK}.tar.xz && \
  38. ln -s /usr/bin/clang-3.8 /usr/bin/clang && \
  39. ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ && \
  40. ln -s /usr/bin/llvm-dsymutil-3.8 /usr/bin/dsymutil && \
  41. UNATTENDED=yes OSX_VERSION_MIN=${OSX_MIN} /tmp/osxcross/build.sh && \
  42. rm -rf /tmp/osxcross/target/SDK/${OSX_SDK}/usr/share && \
  43. cd /tmp && \
  44. tar cfJ osxcross.tar.xz osxcross/target && \
  45. rm -rf /tmp/osxcross && \
  46. apt-get install -y \
  47. bison curl flex gawk gcc g++ gperf help2man libncurses5-dev make patch python-dev texinfo xz-utils && \
  48. curl -L http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${CTNG}.tar.xz \
  49. | tar -xJ -C /tmp/ && \
  50. cd /tmp/crosstool-ng-${CTNG} && \
  51. ./configure --enable-local && \
  52. make && \
  53. ./ct-ng x86_64-centos6-linux-gnu && \
  54. sed -i '/CT_PREFIX_DIR=/d' .config && \
  55. echo 'CT_PREFIX_DIR="/tmp/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"' >> .config && \
  56. echo 'CT_EXPERIMENTAL=y' >> .config && \
  57. echo 'CT_ALLOW_BUILD_AS_ROOT=y' >> .config && \
  58. echo 'CT_ALLOW_BUILD_AS_ROOT_SURE=y' >> .config && \
  59. ./ct-ng build && \
  60. cd /tmp && \
  61. rm /tmp/x86_64-centos6-linux-gnu/build.log.bz2 && \
  62. tar cfJ x86_64-centos6-linux-gnu.tar.xz x86_64-centos6-linux-gnu/ && \
  63. rm -rf /tmp/x86_64-centos6-linux-gnu/ && \
  64. rm -rf /tmp/crosstool-ng-${CTNG}
  65. # base image to crossbuild grafana
  66. FROM ubuntu:14.04
  67. ENV GOVERSION=1.12.9 \
  68. PATH=/usr/local/go/bin:$PATH \
  69. GOPATH=/go \
  70. NODEVERSION=10.14.2
  71. COPY --from=toolchain /tmp/x86_64-centos6-linux-gnu.tar.xz /tmp/
  72. COPY --from=toolchain /tmp/osxcross.tar.xz /tmp/
  73. RUN apt-get update && \
  74. apt-get install -y \
  75. clang-3.8 gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-mingw-w64-x86-64 \
  76. apt-transport-https \
  77. ca-certificates \
  78. curl \
  79. libfontconfig1 \
  80. gcc \
  81. g++ \
  82. git \
  83. make \
  84. rpm \
  85. xz-utils \
  86. expect \
  87. gnupg2 \
  88. unzip && \
  89. ln -s /usr/bin/clang-3.8 /usr/bin/clang && \
  90. ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ && \
  91. ln -s /usr/bin/llvm-dsymutil-3.8 /usr/bin/dsymutil && \
  92. curl -L https://nodejs.org/dist/v${NODEVERSION}/node-v${NODEVERSION}-linux-x64.tar.xz \
  93. | tar -xJ --strip-components=1 -C /usr/local && \
  94. curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
  95. echo "deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main" \
  96. | tee /etc/apt/sources.list.d/yarn.list && \
  97. apt-get update && apt-get install --no-install-recommends yarn && \
  98. curl -L https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz \
  99. | tar -xz -C /usr/local && \
  100. git clone https://github.com/raspberrypi/tools.git /opt/rpi-tools --depth=1
  101. RUN apt-get install -y \
  102. gcc libc-dev make && \
  103. gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
  104. curl -sSL https://get.rvm.io | bash -s stable && \
  105. /bin/bash -l -c "rvm requirements && rvm install 2.2 && gem install -N fpm"
  106. ADD ./bootstrap.sh /tmp/bootstrap.sh