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.
This commit is contained in:
Alex Burka 2024-04-10 20:19:51 +00:00 committed by Randy Mackay
parent 32fc9853f0
commit dcf41cfe81
2 changed files with 2 additions and 1 deletions

View File

@ -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 \ 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 \ DO_AP_STM_ENV=$DO_AP_STM_ENV \
AP_DOCKER_BUILD=1 \
USER=${USER_NAME} \ USER=${USER_NAME} \
Tools/environment_install/install-prereqs-ubuntu.sh -y Tools/environment_install/install-prereqs-ubuntu.sh -y

View File

@ -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..." heading "Check if we are inside docker environment..."
IS_DOCKER=false 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 IS_DOCKER=true
fi fi
echo "Done!" echo "Done!"