Updated entrypoint

This commit is contained in:
Sambo Chea 2021-03-26 21:26:00 +07:00
parent 185a8b5025
commit 708f352a8f
3 changed files with 12 additions and 6 deletions

View File

@ -10,7 +10,7 @@ jobs:
steps: steps:
- name: Starter Docker Test - name: Starter Docker Test
uses: cubetiq/starter-docker-actions@v0.4 uses: cubetiq/starter-docker-actions@v0.5
with: with:
shell: bash shell: bash
run: docker version run: docker version

View File

@ -9,7 +9,7 @@
```yaml ```yaml
- name: Starter Docker - name: Starter Docker
uses: CUBETIQ/starter-docker-actions@v0.4 uses: CUBETIQ/starter-docker-actions@v0.5
``` ```
# Example Action # Example Action
@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: cubetiq/starter-docker-actions@v0.4 - uses: cubetiq/starter-docker-actions@v0.5
- name: Starter Docker Test - name: Starter Docker Test
run: | run: |
docker images docker images

View File

@ -6,10 +6,16 @@ fi
echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script
echo "INPUT RUN => $semicolon_delimited_script"
if [ ! -z $INPUT_DOCKER_NETWORK ]; if [ ! -z $INPUT_DOCKER_NETWORK ];
then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK" then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK"
fi 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`" 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`"