Skip to content

Latest commit

 

History

History
64 lines (54 loc) · 1.62 KB

README.md

File metadata and controls

64 lines (54 loc) · 1.62 KB

DockerRun-Action

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 image
  • registry - Container registry
  • username - Docker username
  • password - Docker password
  • options - Docker options
  • run - Run command in container

How to use this action

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"