Suppose I have a Dockerfile
which runs a script,
RUN ./myscript.sh
How could I write the myscript.sh
so that it could detect if itself is launched by the RUN
command during a docker build
?
#! /bin/bash
# myscript.sh
if <What should I do here?>
then
echo "I am in a docker build"
else
echo "I am not in a docker build"
fi
Ideally, it should not require any changes in the Dockerfile
, so that the caller of myscript.sh
does not need specialized knowledge about myscript.sh
.