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
| FROM centos:7 AS builder LABEL author="Mystic" ARG CMAKE_VERSION="3.24.2"
WORKDIR /var/tmp RUN curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz &&\ tar -zxf cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz && \ \cp -fr cmake-${CMAKE_VERSION}-linux-x86_64/* /usr/local RUN yum upgrade -y
RUN yum install -y centos-release-scl && \ yum install -y devtoolset-11
WORKDIR /app
COPY . .
WORKDIR build
RUN scl enable devtoolset-11 'cmake .. && cmake --build . --target sample --config Release --parallel 8'
FROM centos:7
COPY --from=builder /app/build/sample /sample COPY test .
CMD ["/sample"]
|