This is a simple action to run a docker image in a github action workflow. It only offers the bare minimum of options, however, further options might be added in the future.
The following options are available:
image
(required) - Docker imageregistry
- Container registryusername
- Docker usernamepassword
- Docker passwordoptions
- Docker optionsrun
- Run command in container
It is recommended to set the credentials needed for this action as secrets, you can do this in your repository settings.
An action to run a privately owned docker image could look like the following:
on:
workflow_dispatch:
jobs:
docker:
name: Run privately owned image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run Image
uses: c-schicho/DockerRun-Action@v1
with:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
registry: ghcr.io
image: image:latest
options: -p 80:80
run: echo "hello world"
An action to run a docker imaged built by a previous step could look like the following:
on:
workflow_dispatch:
jobs:
docker:
name: Run image built by previous step
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build docker image
...
- name: Run Image
uses: c-schicho/DockerRun-Action@v1
with:
image: image:latest
options: -p 80:80
run: echo "hello world"