From 708f352a8f197e0b22664a6f26df828c72d99d27 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Fri, 26 Mar 2021 21:26:00 +0700 Subject: [PATCH] Updated entrypoint --- .github/workflows/main.yml | 2 +- README.md | 4 ++-- entrypoint.sh | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3e907c..53e02cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Starter Docker Test - uses: cubetiq/starter-docker-actions@v0.4 + uses: cubetiq/starter-docker-actions@v0.5 with: shell: bash run: docker version diff --git a/README.md b/README.md index 8765e62..a8bc5ea 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ```yaml - name: Starter Docker - uses: CUBETIQ/starter-docker-actions@v0.4 + uses: CUBETIQ/starter-docker-actions@v0.5 ``` # Example Action @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: cubetiq/starter-docker-actions@v0.4 + - uses: cubetiq/starter-docker-actions@v0.5 - name: Starter Docker Test run: | docker images diff --git a/entrypoint.sh b/entrypoint.sh index d5ccf7c..b370284 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,10 +6,16 @@ fi echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script -echo "INPUT RUN => $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`" \ No newline at end of file +if [ -z $INPUT_SHELL ]; +then INPUT_IMAGE=bash +fi + +if [ -z $semicolon_delimited_script ]; +then semicolon_delimited_script="echo $(whoami)" +fi + +exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS $INPUT_IMAGE $INPUT_SHELL -c "`cat semicolon_delimited_script`" \ No newline at end of file