diff --git a/README.md b/README.md index 11f1921..dc5792d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Docker Run Action -- run a privately-owned image. -- run an image built by a previous step. - run a specific step in docker. +- run an image built by a previous step. - See https://github.com/addnab/docker-run-action/blob/main/action.yml for all the available inputs. #### Typical Use Case diff --git a/entrypoint.sh b/entrypoint.sh index cb62a39..e07cdbe 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,4 +6,8 @@ fi echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script -exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$INPUT_DOCKER_NETWORK $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" +if [ ! -z $INPUT_DOCKER_NETWORK ]; +then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK" +fi + +exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`"