• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Create a virtual environment with all tools installed
2# ref: https://hub.docker.com/_/ubuntu
3FROM ubuntu:latest AS env
4LABEL maintainer="corentinl@google.com"
5# Install system build dependencies
6ENV PATH=/usr/local/bin:$PATH
7RUN apt-get update -qq \
8&& DEBIAN_FRONTEND=noninteractive apt-get install -yq git wget libssl-dev build-essential \
9 ninja-build python3 pkgconf libglib2.0-dev \
10&& apt-get clean \
11&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
12ENTRYPOINT ["/usr/bin/bash", "-c"]
13CMD ["/usr/bin/bash"]
14
15# Install CMake 3.21.3
16RUN wget "https://cmake.org/files/v3.21/cmake-3.21.3-linux-x86_64.sh" \
17&& chmod a+x cmake-3.21.3-linux-x86_64.sh \
18&& ./cmake-3.21.3-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
19&& rm cmake-3.21.3-linux-x86_64.sh
20
21FROM env AS devel
22WORKDIR /home/project
23COPY . .
24
25FROM devel AS build
26RUN cmake -version
27RUN cmake -S. -Bbuild
28RUN cmake --build build --target all -v
29RUN cmake --build build --target install -v
30
31FROM build AS test
32ENV CTEST_OUTPUT_ON_FAILURE=1
33RUN cmake --build build --target test -v
34
35# Test install rules
36FROM env AS install_env
37COPY --from=build /usr/local /usr/local/
38
39FROM install_env AS install_devel
40WORKDIR /home/sample
41COPY ci/sample .
42
43FROM install_devel AS install_build
44RUN cmake -S. -Bbuild
45RUN cmake --build build --target all -v
46
47FROM install_build AS install_test
48RUN cmake --build build --target test
49