diff --git a/run-docker.sh b/run-docker.sh index abc52e7..04960e7 100755 --- a/run-docker.sh +++ b/run-docker.sh @@ -1,16 +1,32 @@ #!/bin/bash set -e -IMAGE_NAME="${IMAGE_NAME:-imap-pipeline-core/imap-mag}" +# Example: +# ./run-docker.sh +# ./run-docker.sh -i // for interactive debugging +# ./run-docker.sh -i -e VARIABLE=some_value // for interactive debugging with VARIABLE env var set +IMAGE_NAME="${IMAGE_NAME:-imap-pipeline-core/imap-mag}" -# docker run --rm -it \ -# --entrypoint /bin/bash \ -# --env-file dev.env \ -# -v /mnt/imap-data:/data \ -# $IMAGE_NAME +echo "Running $IMAGE_NAME with dev.env file" -docker run --rm -it \ - --env-file dev.env \ - -v /mnt/imap-data:/data \ - $IMAGE_NAME +# check if the argument "DEBUG" or "-i" is passed +if [ "$1" == "debug" ] || [ "$1" == "DEBUG" ] || [ "$1" == "-i" ]; then + echo "Overriding entrypoint to be an interactive bash shell for debugging" + docker run --rm -it \ + --entrypoint /bin/bash \ + --env-file dev.env \ + -v /mnt/imap-data:/data \ + $IMAGE_NAME +elif [ -z "$1" ]; then # no args passed + docker run --rm -it \ + --env-file dev.env \ + -v /mnt/imap-data:/data \ + $IMAGE_NAME +else + echo "Extra arguments: $@" + docker run --rm -it \ + --env-file dev.env \ + -v /mnt/imap-data:/data \ + $@ $IMAGE_NAME +fi