From dcf41cfe8154d7b3948d251d5f9394af46b2084c Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Wed, 10 Apr 2024 20:19:51 +0000 Subject: [PATCH] docker: fix docker detection in install-prereqs-ubuntu.sh The standard "are we in docker" checks don't seem to work during a build, so just use an environment variable. --- Dockerfile | 1 + Tools/environment_install/install-prereqs-ubuntu.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6eb16c75cb..22d8d67292 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,7 @@ USER ${USER_NAME} RUN SKIP_AP_EXT_ENV=$SKIP_AP_EXT_ENV SKIP_AP_GRAPHIC_ENV=$SKIP_AP_GRAPHIC_ENV SKIP_AP_COV_ENV=$SKIP_AP_COV_ENV SKIP_AP_GIT_CHECK=$SKIP_AP_GIT_CHECK \ DO_AP_STM_ENV=$DO_AP_STM_ENV \ + AP_DOCKER_BUILD=1 \ USER=${USER_NAME} \ Tools/environment_install/install-prereqs-ubuntu.sh -y diff --git a/Tools/environment_install/install-prereqs-ubuntu.sh b/Tools/environment_install/install-prereqs-ubuntu.sh index 2ceb176813..0aea76a53b 100755 --- a/Tools/environment_install/install-prereqs-ubuntu.sh +++ b/Tools/environment_install/install-prereqs-ubuntu.sh @@ -357,7 +357,7 @@ $APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $ARM_LINUX_PKGS $COVERAGE_PKGS heading "Check if we are inside docker environment..." IS_DOCKER=false -if [[ -f /.dockerenv ]] || grep -Eq '(lxc|docker)' /proc/1/cgroup ; then +if [[ ${AP_DOCKER_BUILD:-0} -eq 1 ]] || [[ -f /.dockerenv ]] || grep -Eq '(lxc|docker)' /proc/1/cgroup ; then IS_DOCKER=true fi echo "Done!"