From 0b39321c510c6fa59d950d5ffde8f0244d956ae1 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 25 Apr 2025 19:49:40 +0100 Subject: [PATCH] New explicit Docker selection based on environment variable Everything else breaks after a few years I give up. --- Dockerfile | 2 ++ setup | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94766f1..d4505f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,5 +2,7 @@ FROM ubuntu:20.04 COPY setup / COPY requirements.txt / +# https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container/65942222#65942222 +ENV LKMC_IN_DOCKER=true RUN /setup -y CMD bash diff --git a/setup b/setup index 7338fca..fd71ecf 100755 --- a/setup +++ b/setup @@ -6,14 +6,18 @@ if [ $# -eq 1 ]; then else y= fi -indocker="$(set +e; grep -q docker /proc/1/cgroup; echo $?)" -if [ "$indocker" -eq 0 ]; then +if [ true = "$LKMC_IN_DOCKER" ]; then + indocker=true +else + indocker=false +fi +if "$indocker"; then sudo= export DEBIAN_FRONTEND=noninteractive else sudo=sudo fi -if [ "$indocker" -eq 0 ]; then +if "$indocker"; then $sudo apt update apt install -y software-properties-common add-apt-repository -y ppa:git-core/ppa