cmu-sei / crucible

Crucible is a modular framework for creating, deploying, and managing virtual environments to support training, education, and exercises.
https://cmu-sei.github.io/crucible/
Other
29 stars 16 forks source link

Reusable Build flow #47

Closed ericbram closed 1 year ago

ericbram commented 2 years ago

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 }}
ericbram commented 2 years ago

@sei-aschlackman @sei-noconnor

sei-aschlackman commented 1 year ago

Moved to https://github.com/cmu-sei/Crucible-Github-Actions/blob/main/.github/workflows/docker-build.yaml

Thanks!