Skip to content

Commit

Permalink
build-images: switch to a one-build-context-only approach
Browse files Browse the repository at this point in the history
.. as a random attempt to tackle CMK-18957

Change-Id: Idda88b6a7b5bcb0b6115d3f3b1efe4ed62d1d2c5
  • Loading branch information
Frans Fürst committed Dec 12, 2024
1 parent 4194d88 commit 30baa7d
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 164 deletions.
32 changes: 16 additions & 16 deletions buildscripts/infrastructure/build-nodes/almalinux-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -150,34 +150,34 @@ COPY \
defines.make \
/opt/

COPY --from=scripts \
COPY \
build_lib.sh \
Check_MK-pubkey.gpg \
/opt/

COPY --from=scripts install-gnu-toolchain.sh /opt/
COPY install-gnu-toolchain.sh /opt/
RUN /opt/install-gnu-toolchain.sh

COPY --from=scripts install-valgrind.sh /opt/
COPY install-valgrind.sh /opt/
RUN /opt/install-valgrind.sh

COPY --from=scripts install-cmake.sh /opt/
COPY install-cmake.sh /opt/
RUN /opt/install-cmake.sh

COPY --from=scripts install-protobuf-cpp.sh /opt/
COPY install-protobuf-cpp.sh /opt/
RUN /opt/install-protobuf-cpp.sh

COPY --from=scripts install-openssl.sh /opt/
COPY install-openssl.sh /opt/
RUN /opt/install-openssl.sh

COPY --from=scripts install-python.sh /opt/
COPY install-python.sh /opt/
RUN /opt/install-python.sh

# install GDB after Python as it requires shared object files, see CMK-15854
COPY --from=scripts install-gdb.sh /opt/
COPY install-gdb.sh /opt/
RUN /opt/install-gdb.sh

COPY --from=scripts install-rust-cargo.sh /opt/
COPY install-rust-cargo.sh /opt/
RUN /opt/install-rust-cargo.sh

# Now shrink all the binaries and libraries we produced to build a small image
Expand All @@ -186,7 +186,7 @@ COPY strip_binaries /opt/
RUN /opt/strip_binaries /opt

# Run this AFTER strip_binaries!!
COPY --from=scripts install-bazel.sh /opt/
COPY install-bazel.sh /opt/
RUN /opt/install-bazel.sh

### Actual Build Image ###
Expand All @@ -212,22 +212,22 @@ RUN /opt/install-bazel.sh link-only
RUN /opt/install-rust-cargo.sh link-only

# Install non cached dependencies
COPY --from=scripts install-pipenv.sh /opt/
COPY install-pipenv.sh /opt/
RUN /opt/install-pipenv.sh

COPY --from=omd_distros "${DISTRO_MK_FILE}" /opt/
COPY --from=scripts install-cmk-dependencies.sh /opt/
COPY "${DISTRO_MK_FILE}" /opt/
COPY install-cmk-dependencies.sh /opt/
RUN /opt/install-cmk-dependencies.sh

COPY --from=scripts install-patchelf.sh /opt/
COPY install-patchelf.sh /opt/
RUN /opt/install-patchelf.sh

# The /etc/fstab does not exist in the base image we use. A missing fstab prevents OMD from
# using a tmpfs for /omd/sites/[site]/tmp, which we want to have during our tests. We can
# simply solve this by pre-creating the empty file here.
RUN touch /etc/fstab

COPY --from=scripts ci.bazelrc /etc/
COPY ci.bazelrc /etc/
RUN echo "common:ci --@//:filesystem_layout=fhs" >> /etc/ci.bazelrc

ARG VERS_TAG
Expand All @@ -237,5 +237,5 @@ ENV RUSTUP_HOME=/opt/rust/rustup
LABEL \
com.checkmk.image_type="build-image"

COPY --from=dev_images entrypoint.sh /opt/
COPY entrypoint.sh /opt/
ENTRYPOINT ["/opt/entrypoint.sh"]
32 changes: 16 additions & 16 deletions buildscripts/infrastructure/build-nodes/debian-11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,34 +104,34 @@ COPY \
defines.make \
/opt/

COPY --from=scripts \
COPY \
build_lib.sh \
Check_MK-pubkey.gpg \
/opt/

COPY --from=scripts install-gnu-toolchain.sh /opt/
COPY install-gnu-toolchain.sh /opt/
RUN /opt/install-gnu-toolchain.sh

COPY --from=scripts install-valgrind.sh /opt/
COPY install-valgrind.sh /opt/
RUN /opt/install-valgrind.sh

COPY --from=scripts install-cmake.sh /opt/
COPY install-cmake.sh /opt/
RUN /opt/install-cmake.sh

COPY --from=scripts install-protobuf-cpp.sh /opt/
COPY install-protobuf-cpp.sh /opt/
RUN /opt/install-protobuf-cpp.sh

COPY --from=scripts install-openssl.sh /opt/
COPY install-openssl.sh /opt/
RUN /opt/install-openssl.sh

COPY --from=scripts install-python.sh /opt/
COPY install-python.sh /opt/
RUN /opt/install-python.sh

# install GDB after Python as it requires shared object files, see CMK-15854
COPY --from=scripts install-gdb.sh /opt/
COPY install-gdb.sh /opt/
RUN /opt/install-gdb.sh

COPY --from=scripts install-rust-cargo.sh /opt/
COPY install-rust-cargo.sh /opt/
RUN /opt/install-rust-cargo.sh

# Now shrink all the binaries and libraries we produced to build a small image
Expand All @@ -140,7 +140,7 @@ COPY strip_binaries /opt/
RUN /opt/strip_binaries /opt

# Run this AFTER strip_binaries!!
COPY --from=scripts install-bazel.sh /opt/
COPY install-bazel.sh /opt/
RUN /opt/install-bazel.sh

### Actual Build Image ###
Expand All @@ -166,17 +166,17 @@ RUN /opt/install-bazel.sh link-only
RUN /opt/install-rust-cargo.sh link-only

# Install non cached dependencies
COPY --from=scripts install-pipenv.sh /opt/
COPY install-pipenv.sh /opt/
RUN /opt/install-pipenv.sh

COPY --from=omd_distros "${DISTRO_MK_FILE}" /opt/
COPY --from=scripts install-cmk-dependencies.sh /opt/
COPY "${DISTRO_MK_FILE}" /opt/
COPY install-cmk-dependencies.sh /opt/
RUN /opt/install-cmk-dependencies.sh

COPY --from=scripts install-patchelf.sh /opt/
COPY install-patchelf.sh /opt/
RUN /opt/install-patchelf.sh

COPY --from=scripts ci.bazelrc /etc/
COPY ci.bazelrc /etc/
RUN echo "common:ci --@//:filesystem_layout=lsb" >> /etc/ci.bazelrc

ARG VERS_TAG
Expand All @@ -186,5 +186,5 @@ ENV RUSTUP_HOME=/opt/rust/rustup
LABEL \
com.checkmk.image_type="build-image"

COPY --from=dev_images entrypoint.sh /opt/
COPY entrypoint.sh /opt/
ENTRYPOINT ["/opt/entrypoint.sh"]
32 changes: 16 additions & 16 deletions buildscripts/infrastructure/build-nodes/debian-12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,34 +103,34 @@ COPY \
defines.make \
/opt/

COPY --from=scripts \
COPY \
build_lib.sh \
Check_MK-pubkey.gpg \
/opt/

COPY --from=scripts install-gnu-toolchain.sh /opt/
COPY install-gnu-toolchain.sh /opt/
RUN /opt/install-gnu-toolchain.sh

COPY --from=scripts install-valgrind.sh /opt/
COPY install-valgrind.sh /opt/
RUN /opt/install-valgrind.sh

COPY --from=scripts install-cmake.sh /opt/
COPY install-cmake.sh /opt/
RUN /opt/install-cmake.sh

COPY --from=scripts install-protobuf-cpp.sh /opt/
COPY install-protobuf-cpp.sh /opt/
RUN /opt/install-protobuf-cpp.sh

COPY --from=scripts install-openssl.sh /opt/
COPY install-openssl.sh /opt/
RUN /opt/install-openssl.sh

COPY --from=scripts install-python.sh /opt/
COPY install-python.sh /opt/
RUN /opt/install-python.sh

# install GDB after Python as it requires shared object files, see CMK-15854
COPY --from=scripts install-gdb.sh /opt/
COPY install-gdb.sh /opt/
RUN /opt/install-gdb.sh

COPY --from=scripts install-rust-cargo.sh /opt/
COPY install-rust-cargo.sh /opt/
RUN /opt/install-rust-cargo.sh

# Now shrink all the binaries and libraries we produced to build a small image
Expand All @@ -139,7 +139,7 @@ COPY strip_binaries /opt/
RUN /opt/strip_binaries /opt

# Run this AFTER strip_binaries!!
COPY --from=scripts install-bazel.sh /opt/
COPY install-bazel.sh /opt/
RUN /opt/install-bazel.sh

### Actual Build Image ###
Expand All @@ -165,17 +165,17 @@ RUN /opt/install-bazel.sh link-only
RUN /opt/install-rust-cargo.sh link-only

# Install non cached dependencies
COPY --from=scripts install-pipenv.sh /opt/
COPY install-pipenv.sh /opt/
RUN /opt/install-pipenv.sh

COPY --from=omd_distros "${DISTRO_MK_FILE}" /opt/
COPY --from=scripts install-cmk-dependencies.sh /opt/
COPY "${DISTRO_MK_FILE}" /opt/
COPY install-cmk-dependencies.sh /opt/
RUN /opt/install-cmk-dependencies.sh

COPY --from=scripts install-patchelf.sh /opt/
COPY install-patchelf.sh /opt/
RUN /opt/install-patchelf.sh

COPY --from=scripts ci.bazelrc /etc/
COPY ci.bazelrc /etc/
RUN echo "common:ci --@//:filesystem_layout=lsb" >> /etc/ci.bazelrc

ARG VERS_TAG
Expand All @@ -185,5 +185,5 @@ ENV RUSTUP_HOME=/opt/rust/rustup
LABEL \
com.checkmk.image_type="build-image"

COPY --from=dev_images entrypoint.sh /opt/
COPY entrypoint.sh /opt/
ENTRYPOINT ["/opt/entrypoint.sh"]
32 changes: 16 additions & 16 deletions buildscripts/infrastructure/build-nodes/sles-15sp3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,34 +116,34 @@ COPY \
defines.make \
/opt/

COPY --from=scripts \
COPY \
build_lib.sh \
Check_MK-pubkey.gpg \
/opt/

COPY --from=scripts install-gnu-toolchain.sh /opt/
COPY install-gnu-toolchain.sh /opt/
RUN /opt/install-gnu-toolchain.sh

COPY --from=scripts install-valgrind.sh /opt/
COPY install-valgrind.sh /opt/
RUN /opt/install-valgrind.sh

COPY --from=scripts install-cmake.sh /opt/
COPY install-cmake.sh /opt/
RUN /opt/install-cmake.sh

COPY --from=scripts install-protobuf-cpp.sh /opt/
COPY install-protobuf-cpp.sh /opt/
RUN /opt/install-protobuf-cpp.sh

COPY --from=scripts install-openssl.sh /opt/
COPY install-openssl.sh /opt/
RUN /opt/install-openssl.sh

COPY --from=scripts install-python.sh /opt/
COPY install-python.sh /opt/
RUN /opt/install-python.sh

# install GDB after Python as it requires shared object files, see CMK-15854
COPY --from=scripts install-gdb.sh /opt/
COPY install-gdb.sh /opt/
RUN /opt/install-gdb.sh

COPY --from=scripts install-rust-cargo.sh /opt/
COPY install-rust-cargo.sh /opt/
RUN /opt/install-rust-cargo.sh

# Now shrink all the binaries and libraries we produced to build a small image
Expand All @@ -152,7 +152,7 @@ COPY strip_binaries /opt/
RUN /opt/strip_binaries /opt

# Run this AFTER strip_binaries!!
COPY --from=scripts install-bazel.sh /opt/
COPY install-bazel.sh /opt/
RUN /opt/install-bazel.sh

### Actual Build Image ###
Expand All @@ -178,22 +178,22 @@ RUN /opt/install-bazel.sh link-only
RUN /opt/install-rust-cargo.sh link-only

# Install non cached dependencies
COPY --from=scripts install-pipenv.sh /opt/
COPY install-pipenv.sh /opt/
RUN /opt/install-pipenv.sh

COPY --from=omd_distros "${DISTRO_MK_FILE}" /opt/
COPY --from=scripts install-cmk-dependencies.sh /opt/
COPY "${DISTRO_MK_FILE}" /opt/
COPY install-cmk-dependencies.sh /opt/
RUN /opt/install-cmk-dependencies.sh

COPY --from=scripts install-patchelf.sh /opt/
COPY install-patchelf.sh /opt/
RUN /opt/install-patchelf.sh

# The /etc/fstab does not exist in the base image we use. A missing fstab prevents OMD from
# using a tmpfs for /omd/sites/[site]/tmp, which we want to have during our tests. We can
# simply solve this by pre-creating the empty file here.
RUN touch /etc/fstab

COPY --from=scripts ci.bazelrc /etc/
COPY ci.bazelrc /etc/
RUN echo "common:ci --@//:filesystem_layout=fhs" >> /etc/ci.bazelrc

ARG VERS_TAG
Expand All @@ -203,5 +203,5 @@ ENV RUSTUP_HOME=/opt/rust/rustup
LABEL \
com.checkmk.image_type="build-image"

COPY --from=dev_images entrypoint.sh /opt/
COPY entrypoint.sh /opt/
ENTRYPOINT ["/opt/entrypoint.sh"]
Loading

0 comments on commit 30baa7d

Please sign in to comment.