From 0860d075d1a3e939ce1a6d4d9de96ea227333346 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 10 Jun 2020 21:07:44 -0600 Subject: Compare large and small images --- examples/001/dive-exec.sh | 4 +++- examples/002/Dockerfile | 1 - examples/003/Dockerfile | 5 +++-- examples/003/run.sh | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/001/dive-exec.sh b/examples/001/dive-exec.sh index a14c43d..68de99d 100644 --- a/examples/001/dive-exec.sh +++ b/examples/001/dive-exec.sh @@ -1,6 +1,8 @@ #!/bin/sh set -e -image_id="$(docker image ls developing-with-docker | awk '{ print $3 }' | grep -v REPO | tail -n1)" + +name="$1" +image_id="$(docker image ls "$name" | awk '{ print $3 }' | grep -v REPO | tail -n1)" echo "$ dive $image_id" dive "$image_id" diff --git a/examples/002/Dockerfile b/examples/002/Dockerfile index f875871..304abfb 100644 --- a/examples/002/Dockerfile +++ b/examples/002/Dockerfile @@ -5,4 +5,3 @@ RUN apt-get install -y git RUN apt-get install -y ruby RUN apt-get install -y zstd RUN git clone --verbose https://github.com/spandx/cache.git /opt/db -WORKDIR /opt diff --git a/examples/003/Dockerfile b/examples/003/Dockerfile index 35b83ea..a722743 100644 --- a/examples/003/Dockerfile +++ b/examples/003/Dockerfile @@ -1,8 +1,9 @@ FROM debian:stable-slim ENV PACKAGES git ruby zstd -RUN apt-get update -y --no-install-recommends $PACKAGES \ +RUN apt-get update -y \ + && apt-get install -y --no-install-recommends $PACKAGES \ && git clone https://github.com/spandx/cache.git /opt/db \ && tar --use-compress-program zstd -cf /opt/db.tar.zst /opt/db \ && rm -fr /opt/db COPY run.sh /run.sh -CMD ['/run.sh'] +ENTRYPOINT ["/run.sh"] diff --git a/examples/003/run.sh b/examples/003/run.sh index db1f294..bf50deb 100644 --- a/examples/003/run.sh +++ b/examples/003/run.sh @@ -1,8 +1,8 @@ #!/bin/sh -set -ex +set -e +echo "[$(date +s)] Inflating /opt/db.tar.zst" tar -xf /opt/db.tar.zst - -cd /opt/db/.index -sh +echo sh "$@" +sh "$@" -- cgit v1.2.3