Skip to content

Commit

Permalink
parent 358af5c
Browse files Browse the repository at this point in the history
author Yossi Farjoun <[email protected]> 1617479686 -0400
committer Yossi Farjoun <[email protected]> 1618455120 -0400

Change the way the script is run. instead of modfying the ENTRYPOINT, we will simply add the "shell" (default sh) and the "script_prefix" (default -c)
and then the script.

That way the possible comple entry point is not disturbed. if a user would like to remove the ENTRYPOINT they can provide an "option" "--entrypoint ''" for example.
  • Loading branch information
Yossi Farjoun committed Apr 15, 2021
1 parent 358af5c commit 2f4bbe9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docker Run Action Tests
on:
push:
branches:
- main
- '**'
pull_request:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
run: |
echo "first line"
echo "second line"
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
description: 'Use a specific shell'
required: false
default: sh
script_prefix:
description: 'a prefix telling the shell to execute the following (single) string as a script'
required: false
default: -c
registry:
description: 'Registry'
required: false
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ 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 "${INPUT_RUN//$'\n'/;}"
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS $INPUT_IMAGE $INPUT_SHELL $INPUT_SCRIPT_PREFIX "${INPUT_RUN//$'\n'/;}"

0 comments on commit 2f4bbe9

Please sign in to comment.