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

51 lines
1.3 KiB
Markdown
Raw Normal View History

2020-06-18 00:47:31 +02:00
# Docker Run Action
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.
2020-06-18 03:21:47 +02:00
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.
2020-06-18 00:47:31 +02:00
### Example Usage
2020-06-18 03:21:47 +02:00
#### single-line command
2020-06-18 00:47:31 +02:00
```yaml
- uses: addnab/docker-run-action@v1
with:
image: docker:latest
2020-06-18 03:00:26 +02:00
run: echo "hello world"
```
2020-06-18 03:21:47 +02:00
#### multi-line commands
2020-06-18 03:00:26 +02:00
```yaml
- uses: addnab/docker-run-action@v1
with:
image: docker:latest
run: |
echo "first line"
echo "second line"
2020-06-18 00:47:31 +02:00
```
2020-06-18 03:21:47 +02:00
#### 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"
```