This repository has been archived on 2024-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
docker-run-action/README.md
2021-07-09 11:33:42 +03:00

60 lines
1.3 KiB
Markdown

# Docker Run Action
- run a specific step in docker.
- run an image built by a previous step.
- See https://github.com/addnab/docker-run-action/blob/main/action.yml for all the available inputs.
## Examples
#### Typical Use Case
```yaml
- name: Checkout
uses: actions/checkout@v2 # Required to mount the Github Workspace to a volume
- uses: addnab/docker-run-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
image: private-image:latest
options: -e ABC=123
run: |
echo "Running Script"
/work/run-script
```
#### run a privately-owned image
```yaml
- uses: addnab/docker-run-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
image: test-image:latest
run: echo "hello world"
```
#### run an image built by a previous step
```yaml
- uses: docker/build-push-action@v2
with:
tags: test-image:latest
push: false
- uses: addnab/docker-run-action@v3
with:
image: test-image:latest
run: echo "hello world"
```
#### use a specific shell (default: sh).
*Note: The shell must be installed in the container*
```yaml
- uses: addnab/docker-run-action@v3
with:
image: docker:latest
shell: bash
run: |
echo "first line"
echo "second line"
```