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

57 lines
1.3 KiB
Markdown
Raw Normal View History

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