Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerfile: Optimization of image size #26

Merged
merged 1 commit into from
Jun 6, 2024
Merged
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
46 changes: 25 additions & 21 deletions tools/cluster-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ RUN git clone -b $METRICS_VERSION https://github.com/OpenObservability/OpenMetri
WORKDIR /validator/src
RUN make openmetricsvalidator

FROM debian:latest
ENV CRI_VERSION="v1.17.0"
ENV CTR_VERSION="1.5.0"
ENV RUNC_VERSION="v1.1.4"
ENV CONTAINER_RUNTIME_ENDPOINT=unix:///run/containerd/containerd.sock
ENV IMAGE_SERVICE_ENDPOINT=unix:///run/containerd/containerd.sock

COPY ./sleep /sleep
COPY ./zombie /zombie
FROM debian:stable-slim as wireshark_build

# INSTALL Wireshark
RUN apt update && apt-get install -y build-essential git cmake bison flex libgtk-3-dev libpcap-dev libssl-dev libncurses5-dev qtbase5-dev qttools5-dev-tools qttools5-dev libqt5svg5-dev libtool libgcrypt20-dev libc-ares-dev
Expand All @@ -26,23 +18,35 @@ RUN cd /wireshark && \
make -j`nproc` && \
make install

FROM debian:stable-slim
ENV CRI_VERSION="v1.17.0"
ENV CTR_VERSION="1.5.0"
ENV RUNC_VERSION="v1.1.4"
ENV CONTAINER_RUNTIME_ENDPOINT=unix:///run/containerd/containerd.sock
ENV IMAGE_SERVICE_ENDPOINT=unix:///run/containerd/containerd.sock

COPY ./sleep /sleep
COPY ./zombie /zombie

COPY --from=wireshark_build /usr/local /usr/local
COPY --from=validator /validator/bin/openmetricsvalidator /usr/local/bin/
RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
RUN apt update && apt install -y curl sysbench skopeo net-tools strace
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_VERSION}/crictl-${CRI_VERSION}-linux-amd64.tar.gz --output crictl-${CRI_VERSION}-linux-amd64.tar.gz
RUN tar zxvf crictl-$CRI_VERSION-linux-amd64.tar.gz -C /usr/local/bin
RUN rm -f crictl-$CRI_VERSION-linux-amd64.tar.gz
RUN apt update && apt install -y curl sysbench skopeo net-tools strace libpcap-dev libssl-dev libc-ares-dev libqt5printsupport5

RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRI_VERSION}/crictl-${CRI_VERSION}-linux-amd64.tar.gz --output crictl-${CRI_VERSION}-linux-amd64.tar.gz && \
tar zxvf crictl-$CRI_VERSION-linux-amd64.tar.gz -C /usr/local/bin && \
rm -f crictl-$CRI_VERSION-linux-amd64.tar.gz

RUN curl -L https://github.com/opencontainers/runc/releases/download/${RUNC_VERSION}/runc.amd64 --output /usr/local/bin/runc && chmod +x /usr/local/bin/runc

RUN curl -L https://github.com/containerd/nerdctl/releases/download/v1.2.1/nerdctl-1.2.1-linux-amd64.tar.gz --output nerdctl.tar.gz
RUN tar zxvf nerdctl.tar.gz -C /tmp/
RUN mv /tmp/nerdctl /usr/local/bin/
RUN curl -L https://github.com/containerd/nerdctl/releases/download/v1.2.1/nerdctl-1.2.1-linux-amd64.tar.gz --output nerdctl.tar.gz && \
tar zxvf nerdctl.tar.gz -C /tmp/ && \
mv /tmp/nerdctl /usr/local/bin/ && \
rm -f nerdctl.tar.gz

RUN curl -L https://github.com/containerd/containerd/releases/download/v${CTR_VERSION}/containerd-${CTR_VERSION}-linux-amd64.tar.gz --output containerd-${CTR_VERSION}-linux-amd64.tar.gz
RUN tar zxvf containerd-${CTR_VERSION}-linux-amd64.tar.gz -C /tmp/
RUN mv /tmp/bin/ctr /usr/local/bin


RUN curl -L https://github.com/containerd/containerd/releases/download/v${CTR_VERSION}/containerd-${CTR_VERSION}-linux-amd64.tar.gz --output containerd-${CTR_VERSION}-linux-amd64.tar.gz && \
tar zxvf containerd-${CTR_VERSION}-linux-amd64.tar.gz -C /tmp/ && \
mv /tmp/bin/ctr /usr/local/bin && \
rm -f containerd-${CTR_VERSION}-linux-amd64.tar.gz