43 lines
1.3 KiB
Docker
43 lines
1.3 KiB
Docker
# Create a virtual environment with all tools installed
|
|
# ref: https://hub.docker.com/_/ubuntu
|
|
FROM ubuntu:rolling AS env
|
|
# Install system build dependencies
|
|
ENV PATH=/usr/local/bin:$PATH
|
|
RUN apt-get update -qq \
|
|
&& apt-get install -yq git wget libssl-dev build-essential \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
# Install CMake 3.21.1
|
|
RUN wget -q "https://cmake.org/files/v3.21/cmake-3.21.1-linux-x86_64.sh" \
|
|
&& chmod a+x cmake-3.21.1-linux-x86_64.sh \
|
|
&& ./cmake-3.21.1-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
|
|
&& rm cmake-3.21.1-linux-x86_64.sh
|
|
CMD [ "/usr/bin/bash" ]
|
|
|
|
FROM env AS devel
|
|
WORKDIR /home/project
|
|
COPY . .
|
|
|
|
FROM devel AS build
|
|
RUN cmake -S. -Bbuild -DBUILD_DEPS=ON -DBUILD_CXX=OFF -DBUILD_GLOP=ON
|
|
RUN cmake --build build --target all -v
|
|
RUN cmake --build build --target install
|
|
|
|
FROM build AS test
|
|
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
|
|
|
|
FROM env AS install_env
|
|
COPY --from=build /usr/local /usr/local/
|
|
|
|
FROM install_env AS install_devel
|
|
WORKDIR /home/sample
|
|
COPY cmake/samples/glop .
|
|
|
|
FROM install_devel AS install_build
|
|
RUN cmake -S. -Bbuild
|
|
RUN cmake --build build --target all -v
|
|
RUN cmake --build build --target install
|
|
|
|
FROM install_build AS install_test
|
|
RUN cmake --build build --target test
|