From aa3227fbfb1f703dad433b28023067ece8ee21f0 Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Sun, 8 Oct 2023 16:16:07 -0700 Subject: [PATCH] build-image.sh: Support building the image on Docker. --- install/linux/build-image.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/install/linux/build-image.sh b/install/linux/build-image.sh index 8470ebb..c0fe160 100755 --- a/install/linux/build-image.sh +++ b/install/linux/build-image.sh @@ -1,14 +1,25 @@ #!/bin/sh -set -e +set -euo pipefail TAG=dangerzone.rocks/dangerzone:latest -echo "Building container image" -podman build --pull dangerzone/ -f Dockerfile --tag $TAG +container_runtime() { + if hash podman &>/dev/null; then + podman "$@" + elif hash docker &>/dev/null; then + docker "$@" + else + echo 'No container runtime installed.' >&2 + exit 1 + fi +} -echo "Saving and compressing container image" -podman save $TAG | gzip > share/container.tar.gz +echo "Building container image" >&2 +container_runtime build --pull dangerzone/ -f Dockerfile --tag "$TAG" -echo "Looking up the image id" -podman images -q --filter=reference=$TAG > share/image-id.txt +echo "Saving and compressing container image" >&2 +container_runtime save "$TAG" | gzip > share/container.tar.gz + +echo "Looking up the image id" >&2 +container_runtime images -q --filter=reference="$TAG" > share/image-id.txt