Dockerfile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # This Dockerfile specifies the recipe for creating an image for the tests
  2. # to run in.
  3. #
  4. # We install as many test dependencies here as we can, because these setup
  5. # steps can be cached. They do *not* run every time we run the build.
  6. # The Docker image is only rebuilt when the Dockerfile (ie. this file)
  7. # changes.
  8. # Base Dockerfile for gRPC dev images
  9. FROM debian:latest
  10. # Apt source for old Python versions.
  11. RUN echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main' > /etc/apt/sources.list.d/deadsnakes.list && \
  12. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C
  13. # Apt source for Oracle Java.
  14. run echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
  15. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
  16. echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
  17. # Apt source for Mono
  18. run echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list && \
  19. echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \
  20. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
  21. # Install dotnet SDK based on https://www.microsoft.com/net/core#debian
  22. # (Ubuntu instructions need apt to support https)
  23. RUN apt-get update && apt-get install -y curl libunwind8 gettext && \
  24. curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 && \
  25. mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \
  26. ln -s /opt/dotnet/dotnet /usr/local/bin
  27. # Install dependencies. We start with the basic ones require to build protoc
  28. # and the C++ build
  29. RUN apt-get update && apt-get install -y \
  30. autoconf \
  31. autotools-dev \
  32. build-essential \
  33. bzip2 \
  34. ccache \
  35. curl \
  36. gcc \
  37. git \
  38. libc6 \
  39. libc6-dbg \
  40. libc6-dev \
  41. libgtest-dev \
  42. libtool \
  43. make \
  44. parallel \
  45. time \
  46. wget \
  47. # -- For csharp --
  48. mono-devel \
  49. referenceassemblies-pcl \
  50. nunit \
  51. # -- For all Java builds -- \
  52. maven \
  53. # -- For java_jdk6 -- \
  54. # oops! not in jessie. too old? openjdk-6-jdk \
  55. # -- For java_jdk7 -- \
  56. openjdk-7-jdk \
  57. # -- For java_oracle7 -- \
  58. oracle-java7-installer \
  59. # -- For python / python_cpp -- \
  60. python-setuptools \
  61. python-pip \
  62. python-dev \
  63. python2.6-dev \
  64. python3.3-dev \
  65. python3.4-dev \
  66. # -- For Ruby --
  67. ruby \
  68. && apt-get clean
  69. ##################
  70. # C# dependencies
  71. RUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe
  72. ##################
  73. # Python dependencies
  74. # These packages exist in apt-get, but their versions are too old, so we have
  75. # to get updates from pip.
  76. RUN pip install pip --upgrade
  77. RUN pip install virtualenv tox yattag
  78. ##################
  79. # Ruby dependencies
  80. # Install rvm
  81. RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  82. RUN \curl -sSL https://get.rvm.io | bash -s stable
  83. # Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
  84. RUN /bin/bash -l -c "rvm install ruby-2.1"
  85. RUN /bin/bash -l -c "rvm install ruby-2.2"
  86. RUN /bin/bash -l -c "rvm install jruby-1.7"
  87. RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
  88. RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
  89. RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
  90. ##################
  91. # Java dependencies
  92. # This step requires compiling protoc. :(
  93. ENV MAVEN_REPO /var/maven_local_repository
  94. ENV MVN mvn --batch-mode
  95. RUN cd /tmp && \
  96. git clone https://github.com/google/protobuf.git && \
  97. cd protobuf && \
  98. ./autogen.sh && \
  99. ./configure && \
  100. make -j4 && \
  101. cd java && \
  102. $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
  103. cd ../javanano && \
  104. $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO
  105. ##################
  106. # Go dependencies.
  107. RUN apt-get install -y \
  108. # -- For go -- \
  109. golang
  110. ##################
  111. # Javascript dependencies.
  112. Run apt-get install -y \
  113. # -- For javascript -- \
  114. npm
  115. # On Debian/Ubuntu, nodejs binary is named 'nodejs' because the name 'node'
  116. # is taken by another legacy binary. We don't have that legacy binary and
  117. # npm expects the binary to be named 'node', so we just create a symbol
  118. # link here.
  119. RUN ln -s `which nodejs` /usr/bin/node
  120. ##################
  121. # Prepare ccache
  122. RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
  123. RUN ln -s /usr/bin/ccache /usr/local/bin/g++
  124. RUN ln -s /usr/bin/ccache /usr/local/bin/cc
  125. RUN ln -s /usr/bin/ccache /usr/local/bin/c++
  126. RUN ln -s /usr/bin/ccache /usr/local/bin/clang
  127. RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
  128. # Define the default command.
  129. CMD ["bash"]