Skip to content

Commit

Permalink
matching Dockerfile.agent to 2.7.15 patch
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasSUSE committed Aug 15, 2024
1 parent dc65017 commit 29257b2
Showing 1 changed file with 13 additions and 36 deletions.
49 changes: 13 additions & 36 deletions package/Dockerfile.agent
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ ARG RANCHER_TAG=dev
ARG RANCHER_REPO=rancher
ARG REGISTRY=stgregistry.suse.com
ARG RANCHER_IMAGE=${REGISTRY}/${RANCHER_REPO}/rancher:${RANCHER_TAG}
ARG ARCH
ARG VERSION=dev

FROM --platform=$BUILDPLATFORM registry.suse.com/bci/golang:1.20 AS build
Expand All @@ -22,54 +21,32 @@ RUN go mod download

RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -tags "${TAGS}" -ldflags "${LDFLAGS}" -o agent ./cmd/agent

FROM ${RANCHER_IMAGE} AS rancher

FROM registry.suse.com/bci/bci-micro:15.5 AS final

# Temporary build stage image
FROM registry.suse.com/bci/bci-base:15.5 AS builder

# Install system packages using builder image that has zypper
COPY --from=final / /chroot/

# Install some packages with zypper in the chroot of the final micro image
RUN zypper refresh && \
zypper --installroot /chroot -n in --no-recommends \
curl util-linux ca-certificates ca-certificates-mozilla jq git-core hostname iproute2 vim-small less \
bash-completion bind-utils acl openssh-clients tar gzip xz gawk sysstat openssl patterns-base-fips && \
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/*

# Main stage using bci-micro as the base image
FROM final
ARG ARCH=${ARCH}
ARG VERSION=${VERSION}

# Copy binaries and configuration files from builder to micro
COPY --from=builder /chroot/ /
FROM ${RANCHER_IMAGE} AS rancher

# Test that some of the dependency binaries were copied
# and are working on the target image.
RUN /usr/bin/unshare --version && \
/usr/bin/mount --version && \
/usr/bin/umount --version && \
/usr/bin/nsenter --version
FROM registry.suse.com/bci/bci-base:15.5
ARG ARCH=amd64

ENV KUBECTL_VERSION v1.25.12
RUN curl -sLf https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl > /usr/bin/kubectl && \
RUN zypper -n install --no-recommends curl ca-certificates jq git-core hostname iproute2 vim-small less \
bash-completion bind-utils acl openssh-clients tar gzip xz gawk sysstat && \
zypper -n clean -a && rm -rf /tmp/* /var/tmp/* /usr/share/doc/packages/* && \
curl -sLf https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl > /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl

ENV LOGLEVEL_VERSION v0.1.6
ENV LOGLEVEL_VERSION v0.1.5

RUN curl -sLf https://github.com/rancher/loglevel/releases/download/${LOGLEVEL_VERSION}/loglevel-${ARCH}-${LOGLEVEL_VERSION}.tar.gz | tar xvzf - -C /usr/bin

ARG VERSION=dev
LABEL io.cattle.agent true
ENV AGENT_IMAGE rancher/rancher-agent:${VERSION}
ENV CATTLE_RANCHER_WEBHOOK_MIN_VERSION=''
# For now, this value needs to be manually synced with the one in the main Dockerfile. This pins downstream webhook's version.
ARG CATTLE_RANCHER_WEBHOOK_VERSION
ENV CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION
ENV CATTLE_RANCHER_WEBHOOK_VERSION=2.0.11+up0.3.11
ENV SSL_CERT_DIR /etc/kubernetes/ssl/certs
COPY --from=rancher /var/lib/rancher-data /var/lib/rancher-data
COPY --from=rancher /usr/bin/tini /usr/bin/
COPY --from=build /app/agent /app/package/run.sh /app/package/kubectl-shell.sh /app/package/shell-setup.sh /usr/bin/
WORKDIR /var/lib/rancher
ENTRYPOINT ["run.sh"]
ENTRYPOINT ["run.sh"]

0 comments on commit 29257b2

Please sign in to comment.