73 lines
1.5 KiB
Markdown
73 lines
1.5 KiB
Markdown
# Docker Run Action
|
|
|
|
## features:
|
|
|
|
- run a specific step/command in i docker image
|
|
- run an image built by a previous step
|
|
- See [action.yml](action.yml) for all the available inputs
|
|
|
|
## Examples
|
|
|
|
#### Typical Use Case
|
|
|
|
```yml
|
|
- name: Checkout
|
|
uses: actions/checkout@v3 # Required to mount the Github Workspace to a volume
|
|
|
|
- uses: git.44net.ch/actions/docker-run-action@v1
|
|
env:
|
|
ABC: 123
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
registry: ghcr.io
|
|
image: some-image:latest
|
|
volumes: |
|
|
./testscript.sh:/testscript.sh
|
|
/abc/def:/tmp
|
|
options: |
|
|
--user abc
|
|
run: |
|
|
/bin/bash
|
|
/testscript.sh
|
|
```
|
|
|
|
#### run a privately-owned image
|
|
|
|
```yml
|
|
- uses: git.44net.ch/actions/docker-run-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
registry: gcr.io
|
|
image: some-image:latest
|
|
run: echo "hello world"
|
|
```
|
|
|
|
#### run an image built by a previous step
|
|
|
|
```yml
|
|
- uses: docker/build-push-action@v2
|
|
with:
|
|
tags: some-image:latest
|
|
push: false
|
|
|
|
- uses: git.44net.ch/actions/docker-run-action@v1
|
|
with:
|
|
image: some-image:latest
|
|
run: echo "hello world"
|
|
```
|
|
|
|
#### use a specific shell (default: sh).
|
|
|
|
_Note: The shell must be installed in the container_
|
|
|
|
```yml
|
|
- uses: git.44net.ch/actions/docker-run-action@v1
|
|
with:
|
|
image: docker:latest
|
|
shell: bash
|
|
run: |
|
|
echo "first line"
|
|
echo "second line"
|
|
```
|