forked from LLNL/thicket-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds GitHub Action for building and uploading images
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |