-
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.
Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
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,61 @@ | ||
name: Simple Build Containers | ||
on: | ||
workflow_dispatch: [] | ||
pull_request: [] | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
||
# This is an example Dockerfile matrix - you could imagine extending it to different bases, etc. | ||
# You could also generate this dynamically and pipe in the json. See | ||
# https://github.com/buildsi/spack-containers/blob/11cbac76201e963006b2321e30b153f38687505f/.github/workflows/build-containers.yaml#L24 | ||
|
||
# base image # dockerfile | ||
container: [["ubuntu:20.04", Dockerfile]] | ||
|
||
name: Build ${{ matrix.container[0] }} ${{ matrix.arch }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set Container Name | ||
env: | ||
base: ${{ matrix.container[0] }} | ||
run: | | ||
base=$(echo ${base/:/-}) | ||
container="ghcr.io/vsoch/spack-simple-${base}:latest" | ||
echo "container=${container}" >> $GITHUB_ENV | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Simple Docker Build | ||
run: | | ||
docker build -t ${{ env.container }} --build-arg base=${{ matrix.container[0] }} . | ||
- name: Label | ||
run: | | ||
docker run -i --rm ${{ env.container }} spack compiler list --flat > compilers.txt | ||
labels=$(echo $(tr '\r\n' ',' < compilers.txt)) | ||
labels="org.spack.compilers=${labels}" | ||
printf "Saving compiler labels ${labels}\n" | ||
echo "FROM ${{ env.container }}" > Dockerfile.tmp | ||
docker build -t ${{ env.container }} -f Dockerfile.tmp --label ${labels} . | ||
- name: Deploy | ||
if: ${{ github.event_name != 'pull_request' }} | ||
run: | | ||
docker push ${{ env.container }} |
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