From d70bc2e2617c8d84d963bb0e5cb633fe4f33c237 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Thu, 1 Nov 2018 19:07:36 -0400 Subject: [PATCH] update Signed-off-by: Jess Frazelle --- buildfromtarball/Dockerfile | 11 +++++++++++ buildfromtarball/build.sh | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 buildfromtarball/Dockerfile create mode 100755 buildfromtarball/build.sh diff --git a/buildfromtarball/Dockerfile b/buildfromtarball/Dockerfile new file mode 100644 index 0000000..46734d5 --- /dev/null +++ b/buildfromtarball/Dockerfile @@ -0,0 +1,11 @@ +FROM docker + +RUN apk install --no-cache \ + bash \ + ca-certificates \ + curl \ + tar + +COPY build.sh /usr/local/bin/build + +ENTRYPOINT ["build"] diff --git a/buildfromtarball/build.sh b/buildfromtarball/build.sh new file mode 100755 index 0000000..f543ad9 --- /dev/null +++ b/buildfromtarball/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +set -o pipefail +set -x + +tarball=$1 +image=$2 + +volume=/build + +mkdir -p "$build" + +curl --fail --silent --show-error --location "$tarball" | tar xvz --strip=1 -C %s 2>/dev/null) || (echo ""; printf "ERROR: %%s\n" "Could not prepare an image." "Please verify that $tarball is still available and is publicly accessible."; exit 1) + +# Try to pull the image. +docker pull "$image" || true + +cd "$build" + +docker build --cache-from "$image" -t "$image" . + +docker push "$image"