Skip to content

Commit f888169

Browse files
authored
Add support for non-Docker build tools (e.g., podman) (#288)
* Add support for non-Docker build tools (e.g., `podman`) Some machines (e.g., Fedora-based) do not make it easy to use Docker tooling for building containers. In these environments, `podman` is a workable replacement. This change allows using replacing the use of `docker` with something like: `DOCKER=podman benchmarks/build-all.sh`. * Fix typo
1 parent 8e6f357 commit f888169

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

benchmarks/build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ if [[ ! -d $BENCHMARK_DIR ]]; then
1515
exit 1
1616
fi
1717

18+
DOCKER=${DOCKER:-docker}
1819
BENCHMARK_NAME=$(readlink -f $BENCHMARK_DIR | xargs basename)
1920
IMAGE_NAME=sightglass-benchmark-$BENCHMARK_NAME
2021
TMP_BENCHMARK=$(mktemp -d /tmp/sightglass-benchmark-XXXXXX)
@@ -34,9 +35,9 @@ TMP_TAR=$(mktemp /tmp/sightglass-benchmark-dir-XXXXXX.tar)
3435

3536
# Build the benchmark image and extract the generated `benchmark.wasm` file from its container.
3637
print_header "Build benchmarks"
37-
(set -x; docker build --tag $IMAGE_NAME - < $TMP_TAR)
38-
CONTAINER_ID=$(set -x; docker create $IMAGE_NAME)
39-
(set -x; docker cp $CONTAINER_ID:/benchmark/. $TMP_BENCHMARK)
38+
(set -x; $DOCKER build --tag $IMAGE_NAME - < $TMP_TAR)
39+
CONTAINER_ID=$(set -x; $DOCKER create $IMAGE_NAME)
40+
(set -x; $DOCKER cp $CONTAINER_ID:/benchmark/. $TMP_BENCHMARK)
4041

4142
# Verify benchmark is a valid Sightglass benchmark.
4243
print_header "Verify benchmark"
@@ -52,6 +53,6 @@ done;
5253
print_header "Clean up"
5354
(set -x; rm $TMP_TAR)
5455
(set -x; rm -rf $TMP_BENCHMARK)
55-
(set -x; docker rm $CONTAINER_ID)
56-
# We do not remove the image and intermediate images here (e.g., `docker rmi $IMAGE_NAME`) to speed
56+
(set -x; $DOCKER rm $CONTAINER_ID)
57+
# We do not remove the image and intermediate images here (e.g., `$DOCKER rmi $IMAGE_NAME`) to speed
5758
# up `build-all.sh`; use `clean.sh` instead.

0 commit comments

Comments
 (0)