docker-run-action/README.md

57 lines
1.3 KiB
Markdown
Raw Normal View History

2020-06-17 18:47:31 -04:00
# Docker Run Action
2021-02-15 01:12:38 -05:00
- run a specific step in docker.
2021-02-15 16:21:09 -05:00
- run an image built by a previous step.
2021-02-15 01:12:38 -05:00
- See https://github.com/addnab/docker-run-action/blob/main/action.yml for all the available inputs.
2020-06-17 18:47:31 -04:00
2021-02-15 01:12:38 -05:00
#### Typical Use Case
2020-06-17 18:47:31 -04:00
2020-06-17 21:00:26 -04:00
```yaml
2021-02-15 17:26:10 -05:00
- uses: addnab/docker-run-action@v2
2020-06-17 21:00:26 -04:00
with:
2021-02-15 01:12:38 -05:00
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
image: private-image:latest
options: -v ${{ github.workspace }}:/work -e ABC=123
2020-06-17 21:00:26 -04:00
run: |
2021-02-15 01:27:21 -05:00
echo "Running Script"
/work/run-script
2020-06-17 18:47:31 -04:00
```
2020-06-17 21:21:47 -04:00
2021-02-15 01:12:38 -05:00
#### run a privately-owned image
2020-06-17 21:39:34 -04:00
```yaml
2021-02-15 17:26:10 -05:00
- uses: addnab/docker-run-action@v2
2020-06-17 21:39:34 -04:00
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
image: test-image:latest
run: echo "hello world"
```
2021-02-15 01:12:38 -05:00
#### run an image built by a previous step
2020-06-17 21:21:47 -04:00
```yaml
- uses: docker/build-push-action@v1
with:
repository: test-image
push: false
2021-02-15 17:26:10 -05:00
- uses: addnab/docker-run-action@v2
2020-06-17 21:21:47 -04:00
with:
image: test-image:latest
run: echo "hello world"
```
#### use a specific shell (default: sh).
2020-06-17 21:39:34 -04:00
*Note: The shell must be installed in the container*
2020-06-17 21:21:47 -04:00
```yaml
2021-02-15 17:26:10 -05:00
- uses: addnab/docker-run-action@v2
2020-06-17 21:21:47 -04:00
with:
image: docker:latest
shell: bash
run: |
echo "first line"
echo "second line"
```