run on specific shell
This commit is contained in:
parent
1e284f150e
commit
cff4df74be
31
README.md
31
README.md
@ -2,11 +2,11 @@
|
||||
|
||||
This action targets a very specific use-case that is not currently supported by Github Workflows. This action gives you the capability to run built containers.
|
||||
|
||||
Docker already supports running commands inside a docker image. See [jobs.<jobs_id>.container](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer). But it doesn't give you a clean way to run an image from a private repo or an image built on a previous step.
|
||||
Docker already supports running commands inside a docker image. See [jobs.<jobs_id>.container](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer). But it doesn't give you a clean way to run an image from a private repo or an image built by a previous step.
|
||||
|
||||
### Example Usage
|
||||
|
||||
#### Standard use-case
|
||||
#### single-line command
|
||||
```yaml
|
||||
- uses: addnab/docker-run-action@v1
|
||||
with:
|
||||
@ -14,7 +14,7 @@ Docker already supports running commands inside a docker image. See [jobs.<jobs_
|
||||
run: echo "hello world"
|
||||
```
|
||||
|
||||
#### Multiple commands
|
||||
#### multi-line commands
|
||||
```yaml
|
||||
- uses: addnab/docker-run-action@v1
|
||||
with:
|
||||
@ -23,3 +23,28 @@ Docker already supports running commands inside a docker image. See [jobs.<jobs_
|
||||
echo "first line"
|
||||
echo "second line"
|
||||
```
|
||||
|
||||
#### Run on previously built container.
|
||||
```yaml
|
||||
- uses: docker/build-push-action@v1
|
||||
with:
|
||||
repository: test-image
|
||||
push: false
|
||||
- uses: addnab/docker-run-action@v1
|
||||
with:
|
||||
image: test-image:latest
|
||||
run: echo "hello world"
|
||||
```
|
||||
|
||||
|
||||
#### use a specific shell (default: sh).
|
||||
*Note: The shell must be installe in the container*
|
||||
```yaml
|
||||
- uses: addnab/docker-run-action@v1
|
||||
with:
|
||||
image: docker:latest
|
||||
shell: bash
|
||||
run: |
|
||||
echo "first line"
|
||||
echo "second line"
|
||||
```
|
||||
|
@ -11,6 +11,10 @@ inputs:
|
||||
run:
|
||||
description: 'Run command in container'
|
||||
required: false
|
||||
shell:
|
||||
description: 'Use a specific shell'
|
||||
required: false
|
||||
default: sh
|
||||
registry:
|
||||
description: 'Registry'
|
||||
required: false
|
||||
|
@ -6,4 +6,4 @@ fi
|
||||
|
||||
echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script
|
||||
|
||||
exec docker run $INPUT_OPTIONS $INPUT_IMAGE /bin/sh -c "`cat semicolon_delimited_script`"
|
||||
exec docker run $INPUT_OPTIONS $INPUT_IMAGE /bin/$INPUT_SHELL -c "`cat semicolon_delimited_script`"
|
||||
|
Loading…
Reference in New Issue
Block a user