Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,24 @@ COPY . .
RUN make update-tuned-submodule
RUN make build

FROM quay.io/centos/centos:stream9 as tuned
WORKDIR /root
COPY assets /root/assets
RUN INSTALL_PKGS=" \
gcc git rpm-build make desktop-file-utils patch dnf-plugins-core \
" && \
dnf install --setopt=tsflags=nodocs -y $INSTALL_PKGS && \
cd assets/tuned/tuned && \
LC_COLLATE=C cat ../patches/*.diff | patch -Np1 && \
dnf build-dep tuned.spec -y && \
make rpm PYTHON=/usr/bin/python3 && \
rm -rf /root/rpmbuild/RPMS/noarch/{tuned-gtk*,tuned-utils*,tuned-profiles-compat*}

FROM quay.io/centos/centos:stream9
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/performance-profile-creator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/gather-sysinfo /usr/bin/

ENV ASSETS_DIR=/root/assets
COPY assets $ASSETS_DIR

COPY hack/dockerfile_install_support.sh /tmp
RUN /bin/bash /tmp/dockerfile_install_support.sh

COPY manifests/*.yaml manifests/image-references /manifests/
ENV APP_ROOT=/var/lib/ocp-tuned
ENV PATH=${APP_ROOT}/bin:${PATH}
ENV HOME=${APP_ROOT}
ENV SYSTEMD_IGNORE_CHROOT=1
WORKDIR ${APP_ROOT}
COPY --from=tuned /root/assets/bin /usr/local/bin
COPY --from=tuned /root/rpmbuild/RPMS/noarch /root/rpms
RUN INSTALL_PKGS=" \
nmap-ncat procps-ng pciutils \
" && \
mkdir -p /etc/grub.d/ /boot /var/lib/ocp-tuned && \
dnf install --setopt=tsflags=nodocs -y $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
dnf --setopt=tsflags=nodocs -y install /root/rpms/*.rpm && \
rm -rf /etc/tuned/recommend.d && \
echo auto > /etc/tuned/profile_mode && \
sed -Ei 's|^#?\s*enable_unix_socket\s*=.*$|enable_unix_socket = 1|;s|^#?\s*rollback\s*=.*$|rollback = not_on_exit|;s|^#?\s*profile_dirs\s*=.*$|profile_dirs = /var/lib/ocp-tuned/profiles,/usr/lib/tuned|' \
/etc/tuned/tuned-main.conf && \
touch /etc/sysctl.conf && \
dnf clean all && \
RUN dnf clean all && \
rm -rf /var/cache/yum ~/patches /root/rpms && \
useradd -r -u 499 cluster-node-tuning-operator
ENTRYPOINT ["/usr/bin/cluster-node-tuning-operator"]
Expand Down
23 changes: 9 additions & 14 deletions Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,21 @@ FROM registry.ci.openshift.org/ocp/4.16:base-rhel9
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/performance-profile-creator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/gather-sysinfo /usr/bin/

ENV ASSETS_DIR=/root/assets
COPY assets $ASSETS_DIR

COPY hack/dockerfile_install_support.sh /tmp
RUN /bin/bash /tmp/dockerfile_install_support.sh

COPY manifests/*.yaml manifests/image-references /manifests/
ENV APP_ROOT=/var/lib/ocp-tuned
ENV PATH=${APP_ROOT}/bin:${PATH}
ENV HOME=${APP_ROOT}
ENV SYSTEMD_IGNORE_CHROOT=1
WORKDIR ${APP_ROOT}
COPY assets/bin /usr/local/bin
RUN INSTALL_PKGS=" \
tuned tuned-profiles-atomic tuned-profiles-cpu-partitioning tuned-profiles-mssql tuned-profiles-nfv tuned-profiles-nfv-guest \
tuned-profiles-nfv-host tuned-profiles-openshift tuned-profiles-oracle tuned-profiles-postgresql tuned-profiles-realtime \
tuned-profiles-sap tuned-profiles-sap-hana tuned-profiles-spectrumscale \
nmap-ncat procps-ng pciutils" && \
mkdir -p /etc/grub.d/ /boot /var/lib/ocp-tuned && \
dnf install --setopt=tsflags=nodocs -y $INSTALL_PKGS && \
rm -rf /etc/tuned/recommend.d && \
echo auto > /etc/tuned/profile_mode && \
sed -Ei 's|^#?\s*enable_unix_socket\s*=.*$|enable_unix_socket = 1|;s|^#?\s*rollback\s*=.*$|rollback = not_on_exit|;s|^#?\s*profile_dirs\s*=.*$|profile_dirs = /var/lib/ocp-tuned/profiles,/usr/lib/tuned|' \
/etc/tuned/tuned-main.conf && \
touch /etc/sysctl.conf && \
dnf clean all && \

RUN dnf clean all && \
rm -rf /var/cache/yum ~/patches /root/rpms && \
useradd -r -u 499 cluster-node-tuning-operator
ENTRYPOINT ["/usr/bin/cluster-node-tuning-operator"]
Expand Down
51 changes: 51 additions & 0 deletions hack/dockerfile_install_support.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

set -euo pipefail
set -o xtrace

source /etc/os-release
if [[ "${ID}" == "centos" ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be centos OR fedora, in case we bring back OKD/FCOS builds

@LorbusChris LorbusChris May 14, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, nevermind, this wouldn't work, as OKD/FCOS payload images would still be using the centos base image for components.

Maybe this should instead make use of the ARG TAGS=ocp, which would be overriden in the OKD builds with TAGS=scos for OKD/SCOS and TAGS=fcos for OKD/FCOS.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, not a blocker.


# CentOS OKD build
BUILD_INSTALL_PKGS="gcc git rpm-build make desktop-file-utils patch dnf-plugins-core"
dnf install --setopt=tsflags=nodocs -y ${BUILD_INSTALL_PKGS}
cd /root/assets/tuned/tuned
LC_COLLATE=C cat ../patches/*.diff | patch -Np1
dnf build-dep tuned.spec -y
make rpm PYTHON=/usr/bin/python3
rm -rf /root/rpmbuild/RPMS/noarch/{tuned-gtk*,tuned-utils*,tuned-profiles-compat*};
dnf --setopt=protected_packages= history -y undo 0 # Remove builddep

INSTALL_PKGS="nmap-ncat procps-ng pciutils"
cp -r /root/assets/bin /usr/local/bin
cp -r /root/rpmbuild/RPMS/noarch /root/rpms
mkdir -p /etc/grub.d/ /boot /var/lib/ocp-tuned
dnf install --setopt=tsflags=nodocs -y ${INSTALL_PKGS}
rpm -V ${INSTALL_PKGS}
dnf --setopt=tsflags=nodocs -y install /root/rpms/*.rpm
rm -rf /etc/tuned/recommend.d
echo auto > /etc/tuned/profile_mode
sed -Ei 's|^#?\s*enable_unix_socket\s*=.*$|enable_unix_socket = 1|;s|^#?\s*rollback\s*=.*$|rollback = not_on_exit|;s|^#?\s*profile_dirs\s*=.*$|profile_dirs = /var/lib/ocp-tuned/profiles,/usr/lib/tuned|' /etc/tuned/tuned-main.conf;

# Clean up build tools to remove image footprint
dnf remove --setopt=protected_packages= -y ${BUILD_INSTALL_PKGS}
dnf autoremove -y

else

# RHEL OCP build
INSTALL_PKGS=" \
tuned tuned-profiles-atomic tuned-profiles-cpu-partitioning tuned-profiles-mssql tuned-profiles-nfv tuned-profiles-nfv-guest \
tuned-profiles-nfv-host tuned-profiles-openshift tuned-profiles-oracle tuned-profiles-postgresql tuned-profiles-realtime \
tuned-profiles-sap tuned-profiles-sap-hana tuned-profiles-spectrumscale \
nmap-ncat procps-ng pciutils"
cp -r /root/assets/bin /usr/local/bin
mkdir -p /etc/grub.d/ /boot /var/lib/ocp-tuned
dnf install --setopt=tsflags=nodocs -y ${INSTALL_PKGS}
rm -rf /etc/tuned/recommend.d
echo auto > /etc/tuned/profile_mode
sed -Ei 's|^#?\s*enable_unix_socket\s*=.*$|enable_unix_socket = 1|;s|^#?\s*rollback\s*=.*$|rollback = not_on_exit|;s|^#?\s*profile_dirs\s*=.*$|profile_dirs = /var/lib/ocp-tuned/profiles,/usr/lib/tuned|' /etc/tuned/tuned-main.conf;

fi

touch /etc/sysctl.conf