|
1 | 1 | # DockerFile for grpc4bmi. Installs the C++ bindings in the /usr/local prefix directory in the container. If you are
|
2 | 2 | # planning to run a container with your BMI-enabled model and communicate with it using grpc4bmi, you can use this as a
|
3 | 3 | # base image for your model
|
4 |
| -FROM ubuntu:bionic |
5 |
| -MAINTAINER Gijs van den Oord < [email protected]> |
6 |
| -RUN apt-get update |
| 4 | +FROM ubuntu:24.04 |
| 5 | +LABEL maintainer= "eWaterCycle <[email protected]>" |
| 6 | +LABEL org.opencontainers.image.source="https://github.com/eWaterCycle/grpc4bmi" |
| 7 | + |
| 8 | +ENV GRPC_VERSION="1.66.1" |
| 9 | +ENV BMIC_VERSION="2.1.2" |
| 10 | +ENV BMICXX_VERSION="2.0.2" |
7 | 11 |
|
8 | 12 | # Prerequisite packages
|
9 |
| -RUN apt-get install -y wget git build-essential g++ make cmake curl automake libtool pkg-config gfortran |
| 13 | +RUN apt-get update && apt-get install -y \ |
| 14 | + automake \ |
| 15 | + build-essential \ |
| 16 | + cmake \ |
| 17 | + curl \ |
| 18 | + g++ \ |
| 19 | + gfortran \ |
| 20 | + git \ |
| 21 | + libtool \ |
| 22 | + libssl-dev \ |
| 23 | + make \ |
| 24 | + pkg-config \ |
| 25 | + vim-tiny \ |
| 26 | + wget \ |
| 27 | + && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 28 | + |
| 29 | +# Build grpc from source (removing git history saves 1.7 GB) |
| 30 | +RUN git clone --branch v${GRPC_VERSION} --depth 1 --recurse-submodules https://github.com/grpc/grpc /opt/grpc && \ |
| 31 | + rm -rf /opt/grpc/.git |
| 32 | +WORKDIR /opt/grpc/cmake/_build |
| 33 | +RUN cmake ../.. \ |
| 34 | + -DgRPC_INSTALL=ON \ |
| 35 | + -DgRPC_SSL_PROVIDER=package \ |
| 36 | + -DgRPC_BUILD_TESTS=OFF \ |
| 37 | + -DCMAKE_CXX_STANDARD=17 \ |
| 38 | + -DBUILD_SHARED_LIBS=ON && \ |
| 39 | + make install && \ |
| 40 | + make clean |
10 | 41 |
|
11 |
| -# Build grpc from source |
12 |
| -RUN git clone -b $(curl -L https://grpc.io/release) --depth=1 https://github.com/grpc/grpc /opt/grpc |
13 |
| -WORKDIR /opt/grpc |
14 |
| -RUN git submodule update --init --recursive |
15 |
| -RUN make install |
16 |
| -WORKDIR third_party/protobuf |
17 |
| -RUN make install |
| 42 | +# Build bmi-c and bmi-cxx from source |
| 43 | +RUN git clone --branch v${BMIC_VERSION} https://github.com/csdms/bmi-c /opt/bmi-c |
| 44 | +WORKDIR /opt/bmi-c/_build |
| 45 | +RUN cmake .. && \ |
| 46 | + make install && \ |
| 47 | + make clean |
| 48 | +RUN git clone --branch v${BMICXX_VERSION} https://github.com/csdms/bmi-cxx /opt/bmi-cxx |
| 49 | +WORKDIR /opt/bmi-cxx/_build |
| 50 | +RUN cmake .. && \ |
| 51 | + make install && \ |
| 52 | + make clean |
18 | 53 |
|
19 |
| -# Build bmi-c from source |
20 |
| -RUN git clone --depth=1 https://github.com/eWaterCycle/grpc4bmi.git /opt/grpc4bmi |
21 |
| -WORKDIR /opt/grpc4bmi |
22 |
| -RUN git submodule update --init --recursive |
23 |
| -RUN mkdir -p /opt/grpc4bmi/cpp/bmi-c/build |
24 |
| -WORKDIR /opt/grpc4bmi/cpp/bmi-c/build |
25 |
| -RUN cmake .. |
26 |
| -RUN make install |
| 54 | +RUN ldconfig |
27 | 55 |
|
28 | 56 | # Build grpc4bmi from source
|
29 |
| -RUN mkdir -p /opt/grpc4bmi/cpp/build |
30 |
| -WORKDIR /opt/grpc4bmi/cpp/build |
31 |
| -RUN cmake .. |
32 |
| -RUN make install |
| 57 | +COPY . /opt/grpc4bmi |
| 58 | +WORKDIR /opt/grpc4bmi/cpp/_build |
| 59 | +RUN cmake .. -DCMAKE_CXX_STANDARD=17 && \ |
| 60 | + make && \ |
| 61 | + ctest && \ |
| 62 | + make install && \ |
| 63 | + make clean |
| 64 | + |
| 65 | +WORKDIR /opt |
0 commit comments