system-agent/package/Dockerfile.suc

51 lines
2.0 KiB
Docker

ARG IMG_VERSION=15.6
FROM registry.suse.com/bci/bci-micro:${IMG_VERSION} AS final
# Temporary build stage image
FROM registry.suse.com/bci/bci-base:${IMG_VERSION} AS builder
# Install system packages using builder image that has zypper
COPY --from=final / /chroot/
RUN zypper refresh && \
zypper --installroot /chroot -n in --no-recommends \
openssl patterns-base-fips grep && \
zypper --installroot /chroot clean -a && \
rm -rf /chroot/var/cache/zypp/* /chroot/var/log/zypp/* /chroot/tmp/* /chroot/var/tmp/* /chroot/usr/share/doc/packages/*
ARG KUBECTL_VERSION=v1.29.7
# https://dl.k8s.io/release/v1.29.7/bin/linux/arm64/kubectl.sha256
ENV KUBECTL_SUM_arm64=7b6649aaa298be728c5fb7ccb65f98738a4e8bda0741afbd5a9ed9e488c0e725
# https://dl.k8s.io/release/v1.29.7/bin/linux/amd64/kubectl.sha256
ENV KUBECTL_SUM_amd64=e3df008ef60ea50286ea93c3c40a020e178a338cea64a185b4e21792d88c75d6
RUN zypper in -y curl openssl patterns-base-fips
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then ARCH=amd64; fi && \
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; fi && \
curl -L -f -o kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" && \
install -o root -g root -m 0755 kubectl /chroot/usr/bin/kubectl && \
KUBECTL_SUM="KUBECTL_SUM_${ARCH}" && echo "${!KUBECTL_SUM} /chroot/usr/bin/kubectl" | sha256sum -c -
RUN /chroot/usr/bin/kubectl version --client
# Main stage using bci-micro as the base image
FROM final
# Copy binaries and configuration files from builder to micro
COPY --from=builder /chroot/ /
ENV CATTLE_AGENT_VAR_DIR="/var/lib/rancher/agent"
RUN mkdir /opt/rancher-system-agent-suc
COPY install.sh /opt/rancher-system-agent-suc/install.sh
COPY system-agent-uninstall.sh /opt/rancher-system-agent-suc/system-agent-uninstall.sh
COPY bin/rancher-system-agent /opt/rancher-system-agent-suc
COPY package/suc/run.sh /opt/rancher-system-agent-suc/run.sh
RUN chmod +x /opt/rancher-system-agent-suc/rancher-system-agent
ENTRYPOINT ["/opt/rancher-system-agent-suc/run.sh"]