Skip to content

Commit

Permalink
Adds GitHub Action for building and uploading images
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumsden committed Aug 5, 2024
1 parent 908f9e8 commit b951737
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build_docker_images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build containers for the Thicket Tutorial

on:
workflow_dispatch:
inputs:
tutorial_name:
description: 'Name of the tutorial. Will be used as the container tag.'
required: true
type: string

jobs:
build-containers:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
registry_url_base: ["ghcr.io/LLNL"]
container_info: [["thicket-tutorial-hub", "docker/Dockerfile.hub"],
["thicket-tutorial-init", "docker/Dockerfile.init"],
["thicket-tutorial-spawn", "docker/Dockerfile.spawn"]]

steps:
- name: Clone the thicket-tutorial repo
uses: actions/checkout@v4

- name: Clean unneeded stuff in runner to make space for the Docker image
uses: jlumbroso/[email protected]
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true

- name: GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull existing layers
env:
container: ${{ matrix.registry_url_base }}/${{ matrix.container_info[0] }}:${{ inputs.tutorial_name }}
run: |
docker pull ${container} || echo "${container} has not been pushed yet"
- name: Build Container
env:
container: ${{ matrix.registry_url_base }}/${{ matrix.container_info[0] }}:${{ inputs.tutorial_name }}
dockerfile: ${{ matrix.container_info[1] }}
run: |
docker build -f ${dockerfile} -t ${container} .
- name: Deploy Container
env:
container: ${{ matrix.registry_url_base }}/${{ matrix.container_info[0] }}:${{ inputs.tutorial_name }}
run: docker push ${container}

0 comments on commit b951737

Please sign in to comment.