diff --git a/Dockerfile b/Dockerfile index e9367f72cb..629b2fbc36 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 c8cdd2cfc3..49da0dd08b 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -2,7 +2,7 @@ ################################################################################################## # hoobs-build # -# Copyright (C) 2019 HOOBS # +# Copyright (C) 2020 HOOBS # # Copyright (C) 2015 Raspberry Pi (Trading) Ltd. # # # # This program is free software: you can redistribute it and/or modify # @@ -93,7 +93,16 @@ 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