This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
[WIP] Workflow for building and ingesting software that uses the Apptainer easyblock #32
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
name: Build and publish container image | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- containers/docker/rocky8/* | |
pull_request: | |
branches: | |
- master | |
paths: | |
- containers/docker/rocky8/* | |
# Declare default permissions as read-only. | |
permissions: read-all | |
jobs: | |
build_and_publish: | |
name: Build and publish image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1 | |
- name: Cache Docker layers | |
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx | |
restore-keys: | | |
${{ runner.os }}-buildx | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 #v3.2.0 | |
with: | |
file: containers/docker/rocky8/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/${{ github.repository_owner }}/build-node:rocky8 | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |