forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.agent
47 lines (36 loc) · 1.9 KB
/
Dockerfile.agent
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ARG RANCHER_TAG=dev
ARG RANCHER_REPO=rancher
FROM ${RANCHER_REPO}/rancher:${RANCHER_TAG} 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 --installroot /chroot -n --gpg-auto-import-keys in --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 --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 bco-micro as the base image
FROM final
# Copy binaries and configuration files from builder to micro
COPY --from=builder /chroot/ /
ARG ARCH=amd64
ENV KUBECTL_VERSION v1.27.10
RUN 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.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}
# 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 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 agent run.sh kubectl-shell.sh shell-setup.sh /usr/bin/
WORKDIR /var/lib/rancher
ENTRYPOINT ["run.sh"]