aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/dockerfile/grpc_ruby_base/Dockerfile
blob: 0d872069d70ed6e7ccf4363fe0c9147ca12fc177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Base Dockerfile for gRPC Ruby.
#
# Includes Ruby installation dependencies, things that are unlikely to vary.
FROM grpc/base

# Allows 'source' to work
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# Install RVM dependencies
RUN apt-get update && apt-get install -y \
    autoconf \
    automake \
    bison \
    curl \
    g++ \
    gawk \
    gcc \
    libc6-dev \
    libffi-dev \
    libgdbm-dev \
    libncurses5-dev \
    libreadline6-dev \
    libsqlite3-dev \
    libssl-dev \
    libtool \
    libyaml-dev \
    make \
    patch \
    pkg-config \
    procps \
    sqlite3 \
    zlib1g-dev

# Install RVM, use this to install ruby
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3  # Needed for RVM
RUN /bin/bash -l -c "curl -L get.rvm.io | bash -s stable"

# Install Ruby 2.1
RUN /bin/bash -l -c "rvm install ruby-2.1"
RUN /bin/bash -l -c "rvm use --default ruby-2.1"
RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"

# Get the source from GitHub
RUN git clone git@github.com:grpc/grpc.git /var/local/git/grpc
RUN cd /var/local/git/grpc && \
  git pull --recurse-submodules && \
  git submodule update --init --recursive

# Build and install the protobuf library
RUN cd /var/local/git/grpc/third_party/protobuf && \
  ./autogen.sh && \
  ./configure --prefix=/usr && \
  make -j12 && make check && make install && make clean

# TODO: pre-building seems unnecessary, because we need to run make clean
# anyway to prevent build from crashing if header files are added/removed.
# Build the C core
RUN make static_c shared_c -j12 -C /var/local/git/grpc

# Define the default command.
CMD ["bash"]