mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
ci: Reduce intermediate docker layers and final image size
Instead of `COPY` to get tar files, execute `RUN` w/ `--mount`. Note that this requires the docker "buildkit" feature to be enabled.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
FROM debian:10 as iwyu-build
|
||||
FROM debian:10 AS iwyu-build
|
||||
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
|
||||
|
||||
COPY install_iwyu.sh /root/install_iwyu.sh
|
||||
RUN sh /root/install_iwyu.sh
|
||||
|
||||
FROM debian:10 as rvm-build
|
||||
FROM debian:10 AS rvm-build
|
||||
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
|
||||
|
||||
COPY install_rvm.sh /root/install_rvm.sh
|
||||
@@ -16,10 +16,9 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
|
||||
COPY install_deps.sh /root/install_deps.sh
|
||||
RUN sh /root/install_deps.sh
|
||||
|
||||
COPY --from=iwyu-build /root/iwyu.tar.gz /root/iwyu.tar.gz
|
||||
RUN tar -C / -xf /root/iwyu.tar.gz
|
||||
RUN ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0
|
||||
RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \
|
||||
tar -C / -xf /root/iwyu.tar \
|
||||
&& ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0
|
||||
|
||||
COPY --from=rvm-build /root/rvm.tar /root/rvm.tar
|
||||
RUN tar -C /usr/local -xf /root/rvm.tar \
|
||||
&& rm /root/rvm.tar
|
||||
RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
|
||||
tar -C /usr/local -xf /root/rvm.tar
|
||||
|
||||
@@ -29,4 +29,4 @@ cmake -GNinja \
|
||||
..
|
||||
ninja
|
||||
DESTDIR=/root/iwyu-destdir ninja install
|
||||
tar -C /root/iwyu-destdir -cf /root/iwyu.tar.gz .
|
||||
tar -C /root/iwyu-destdir -cf /root/iwyu.tar .
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM fedora:37 as rvm-build
|
||||
FROM fedora:37 AS rvm-build
|
||||
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
|
||||
|
||||
COPY install_rvm.sh /root/install_rvm.sh
|
||||
@@ -10,7 +10,7 @@ MAINTAINER Kyle Edwards <kyle.edwards@kitware.com>
|
||||
COPY install_clang_tidy_headers.sh /root/install_clang_tidy_headers.sh
|
||||
RUN sh /root/install_clang_tidy_headers.sh
|
||||
|
||||
FROM fedora:37 AS iwyu
|
||||
FROM fedora:37 AS iwyu-build
|
||||
MAINTAINER Kyle Edwards <kyle.edwards@kitware.com>
|
||||
|
||||
COPY install_iwyu.sh /root/install_iwyu.sh
|
||||
@@ -22,12 +22,11 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
|
||||
COPY install_deps.sh /root/install_deps.sh
|
||||
RUN sh /root/install_deps.sh
|
||||
|
||||
COPY --from=rvm-build /root/rvm.tar /root/rvm.tar
|
||||
RUN tar -C /usr/local -xf /root/rvm.tar \
|
||||
&& rm /root/rvm.tar
|
||||
COPY --from=clang-tidy-headers /root/clang-tidy-headers.tar /root/clang-tidy-headers.tar
|
||||
RUN tar -C /usr/include -xf /root/clang-tidy-headers.tar \
|
||||
&& rm /root/clang-tidy-headers.tar
|
||||
COPY --from=iwyu /root/iwyu.tar /root/iwyu.tar
|
||||
RUN tar -C / -xf /root/iwyu.tar \
|
||||
&& rm /root/iwyu.tar
|
||||
RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
|
||||
tar -C /usr/local -xf /root/rvm.tar
|
||||
|
||||
RUN --mount=type=bind,from=clang-tidy-headers,source=/root,target=/root \
|
||||
tar -C /usr/include -xf /root/clang-tidy-headers.tar
|
||||
|
||||
RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \
|
||||
tar -C / -xf /root/iwyu.tar
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
### Debian
|
||||
|
||||
.debian10:
|
||||
image: "kitware/cmake:ci-debian10-x86_64-2023-01-26"
|
||||
image: "kitware/cmake:ci-debian10-x86_64-2023-02-06"
|
||||
|
||||
variables:
|
||||
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
|
||||
@@ -69,7 +69,7 @@
|
||||
### Fedora
|
||||
|
||||
.fedora37:
|
||||
image: "kitware/cmake:ci-fedora37-x86_64-2023-01-26"
|
||||
image: "kitware/cmake:ci-fedora37-x86_64-2023-02-06"
|
||||
|
||||
variables:
|
||||
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
|
||||
|
||||
Reference in New Issue
Block a user