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