This creates a reusable flow that does the Docker Build & Publish that is currently copy-pasted in every Crucible repo.
Reusable flows run in the context of the caller, so most of the logic stays the same. Note that there is an optional dockerfile-path value that defaults to ./Dockerfile if not specified.
Here is a working and tested example of using this flow from the Vm.Api:
name: Build and Publish Image
on:
pull_request:
branches:
- development
push:
branches: [ development, staging ]
release:
types: [ "published" ]
workflow_dispatch:
inputs:
tagName:
description: 'Tag of the image you want to build and push'
required: true
jobs:
build-and-publish:
name: Build and Publish
uses: cmu-sei/crucible/.github/workflows/docker-image.yml@main
with:
image-name: cmusei/vm-api
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
This creates a reusable flow that does the Docker Build & Publish that is currently copy-pasted in every Crucible repo.
Reusable flows run in the context of the caller, so most of the logic stays the same. Note that there is an optional
dockerfile-path
value that defaults to./Dockerfile
if not specified.Here is a working and tested example of using this flow from the
Vm.Api
: