From a9e8c779ec4394931a9d1bc38845976670cff461 Mon Sep 17 00:00:00 2001 From: Robert Volkmann <20912167+robertvolkmann@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:33:57 +0200 Subject: [PATCH] Put SONiC VM image into a separate container image (#189) --- images/sonic/Dockerfile | 10 +++------- images/sonic/base/Dockerfile | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 images/sonic/base/Dockerfile diff --git a/images/sonic/Dockerfile b/images/sonic/Dockerfile index 8279514..6cbd4c4 100644 --- a/images/sonic/Dockerfile +++ b/images/sonic/Dockerfile @@ -1,10 +1,6 @@ -FROM debian:bookworm-slim +FROM docker.io/library/debian:bookworm-slim ENV LIBGUESTFS_BACKEND=direct -# Check: https://sonic-build.azurewebsites.net/ui/sonic/pipelines -ARG SONIC_BASE_URL=https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=202311&platform=vs -ARG SONIC_IMG_URL=${SONIC_BASE_URL}&target=target%2Fsonic-vs.img.gz -ARG FRR_RELOAD_URL=${SONIC_BASE_URL}&target=target%2Fdebs%2Fbullseye%2Ffrr-pythontools_8.5.1-sonic-0_all.deb RUN apt-get update && \ apt-get --no-install-recommends install --yes \ @@ -16,8 +12,8 @@ RUN apt-get update && \ qemu-system-x86 \ telnet -RUN curl --location --output - "${SONIC_IMG_URL}" | gunzip > sonic-vs.img && \ - curl --location --output /frr-pythontools.deb "${FRR_RELOAD_URL}" +COPY --from=ghcr.io/metal-stack/mini-lab-sonic:base /sonic-vs.img /sonic-vs.img +COPY --from=ghcr.io/metal-stack/mini-lab-sonic:base /frr-pythontools.deb /frr-pythontools.deb ENTRYPOINT ["/launch.py"] diff --git a/images/sonic/base/Dockerfile b/images/sonic/base/Dockerfile new file mode 100644 index 0000000..2bf9980 --- /dev/null +++ b/images/sonic/base/Dockerfile @@ -0,0 +1,25 @@ +# Check: https://sonic-build.azurewebsites.net/ui/sonic/pipelines +ARG SONIC_BASE_URL=https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=202311&platform=vs +ARG SONIC_IMG_URL=${SONIC_BASE_URL}&target=target%2Fsonic-vs.img.gz +ARG FRR_RELOAD_URL=${SONIC_BASE_URL}&target=target%2Fdebs%2Fbullseye%2Ffrr-pythontools_8.5.1-sonic-0_all.deb + +FROM docker.io/library/busybox:stable AS download + +ARG SONIC_IMG_URL +ARG FRR_RELOAD_URL + +ADD "${SONIC_IMG_URL}" /sonic-vs.img.gz +ADD "${FRR_RELOAD_URL}" /frr-pythontools.deb + +RUN gunzip /sonic-vs.img.gz + +FROM scratch + +ARG SONIC_IMG_URL +ARG FRR_RELOAD_URL + +LABEL sonic-img-url=${SONIC_IMG_URL} \ + frr-reload-url=${FRR_RELOAD_URL} + +COPY --from=download /frr-pythontools.deb /frr-pythontools.deb +COPY --from=download /sonic-vs.img /sonic-vs.img