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

74 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2020-06-18 00:47:31 +02:00
# Docker Run Action
2023-08-16 11:20:10 +02:00
## 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
2020-06-18 00:47:31 +02:00
2021-03-18 01:49:17 +01:00
## Examples
2021-02-15 07:12:38 +01:00
#### Typical Use Case
2020-06-18 00:47:31 +02:00
2023-08-16 11:20:10 +02:00
```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
2020-06-18 03:00:26 +02:00
with:
2023-08-16 11:20:10 +02:00
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ghcr.io
image: some-image:latest
2023-08-16 11:44:42 +02:00
volumes: >-
2023-08-16 11:20:10 +02:00
./testscript.sh:/testscript.sh
/abc/def:/tmp
2023-08-16 11:44:42 +02:00
options: >-
2023-08-16 11:20:10 +02:00
--user abc
2023-08-16 11:44:42 +02:00
run: >-
2023-08-16 11:20:10 +02:00
/bin/bash
/testscript.sh
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
2023-08-16 11:20:10 +02:00
```yml
- uses: git.44net.ch/actions/docker-run-action@v1
2020-06-18 03:39:34 +02:00
with:
2023-08-16 11:20:10 +02:00
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
image: some-image:latest
run: echo "hello world"
2020-06-18 03:39:34 +02:00
```
2021-02-15 07:12:38 +01:00
#### run an image built by a previous step
2023-08-16 11:20:10 +02:00
```yml
- uses: docker/build-push-action@v2
2020-06-18 03:21:47 +02:00
with:
2023-08-16 11:20:10 +02:00
tags: some-image:latest
push: false
- uses: git.44net.ch/actions/docker-run-action@v1
2020-06-18 03:21:47 +02:00
with:
2023-08-16 11:20:10 +02:00
image: some-image:latest
run: echo "hello world"
2020-06-18 03:21:47 +02:00
```
2023-08-16 11:20:10 +02:00
#### use a specific shell (default: sh).
_Note: The shell must be installed in the container_
2020-06-18 03:21:47 +02:00
2023-08-16 11:20:10 +02:00
```yml
- uses: git.44net.ch/actions/docker-run-action@v1
2020-06-18 03:21:47 +02:00
with:
2023-08-16 11:20:10 +02:00
image: docker:latest
shell: bash
2023-08-16 11:44:42 +02:00
run: >-
2023-08-16 11:20:10 +02:00
echo "first line"
echo "second line"
2020-06-18 03:21:47 +02:00
```