aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAni <[email protected]>2020-10-06 02:58:18 -0700
committerGitHub <[email protected]>2020-10-06 10:58:18 +0100
commitdd96ca1c8629da6589b381546e2b7677c7611744 (patch)
treec0ac51b5acf50e4641ad02b7cf5b8086ad8ece52
parentd1596451b9d81c360c6cf89a10ed1c30e19e4e02 (diff)
Automagically use i386/debian:buster (#415)
* Autmagically use 1386/debian:buster when running on 64-bit host to prevent error #271
-rw-r--r--Dockerfile3
-rwxr-xr-xbuild-docker.sh12
2 files changed, 13 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index 2e53149..3d5874d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,5 @@
-FROM debian:buster
+ARG BASE_IMAGE=debian:buster
+FROM ${BASE_IMAGE}
ENV DEBIAN_FRONTEND noninteractive
diff --git a/build-docker.sh b/build-docker.sh
index b6a9ea3..350f722 100755
--- a/build-docker.sh
+++ b/build-docker.sh
@@ -73,7 +73,17 @@ fi
# Modify original build-options to allow config file to be mounted in the docker container
BUILD_OPTS="$(echo "${BUILD_OPTS:-}" | sed -E 's@\-c\s?([^ ]+)@-c /config@')"
-${DOCKER} build -t pi-gen "${DIR}"
+# Check the arch of the machine we're running on. If it's 64-bit, use a 32-bit base image instead
+case "$(uname -m)" in
+ x86_64|aarch64)
+ BASE_IMAGE=i386/debian:buster
+ ;;
+ *)
+ BASE_IMAGE=debian:buster
+ ;;
+esac
+${DOCKER} build --build-arg BASE_IMAGE=${BASE_IMAGE} -t pi-gen "${DIR}"
+
if [ "${CONTAINER_EXISTS}" != "" ]; then
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM
time ${DOCKER} run --rm --privileged \