Publish Docker image based on DUNEPDELab Tutorials 2022 module v2.9 #77
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: Publish Docker image based on DUNEPDELab Tutorials 2022 module v2.9 | |
on: | |
# release: | |
# types: [published] | |
push: | |
branches: [main] | |
paths: | |
- src/Docker/DUNEPDELabTutorials.Dockerfile | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: "0 13 * * 5" | |
jobs: | |
push_image: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 34000 | |
remove-dotnet: "true" | |
remove-android: "true" | |
remove-haskell: "true" | |
remove-codeql: "true" | |
- name: Partial Clone | |
shell: bash | |
run: | | |
REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
git config --global user.email [email protected] | |
git config --global user.name github-actions | |
git clone -q --filter=blob:none --no-checkout --depth=1 --sparse $REPO && cd introductory-review | |
git sparse-checkout set src/Docker | |
git checkout | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-dunepdelabtutorials-cache | |
key: ${{ runner.os }}-buildx-dunepdelabtutorials-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-dunepdelabtutorials- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./introductory-review/src/Docker/DUNEPDELabTutorials.Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ghcr.io/cpp-review-dune/introductory-review/dunepdelabtutorials:latest | |
cache-from: type=local,src=/tmp/.buildx-dunepdelabtutorials-cache | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-main-cache | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-dunepdelabtutorials-cache | |
mv /tmp/.buildx-main-cache /tmp/.buildx-dunepdelabtutorials-cache | |
# - name: Scan for vulnerabilities | |
# uses: crazy-max/ghaction-container-scan@master | |
# with: | |
# image: ghcr.io/cpp-review-dune/introductory-review/dunepdelabtutorials:latest | |
# annotations: true | |
# severity_threshold: CRITICAL | |
# dockerfile: ./src/Docker/DUNEPDELabTutorials.Dockerfile | |
- name: Prune untagged images | |
uses: carlosal1015/ghcr-delete-image-action@main | |
with: | |
owner: cpp-review-dune | |
name: introductory-review/dunepdelabtutorials | |
token: ${{ secrets.PAT }} | |
untagged-keep-latest: 2 |