Skip to content

Commit

Permalink
workflows: Add petsc docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeLeibowitz committed Oct 31, 2024
1 parent 2ecf48a commit 9ef17eb
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
96 changes: 96 additions & 0 deletions .github/workflows/docker-petsc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build PETSc Docker images

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master
workflow_dispatch:
schedule:
# Run once a week
- cron: "0 13 * * 1"

jobs:
#######################################################
############## Basic gcc CPU ##########################
#######################################################
deploy-cpu-bases:
name: "cpu-base"
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"

steps:
- name: Checkout devito
uses: actions/checkout@v4

- name: Check event name
run: echo ${{ github.event_name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: cleanup
run: docker system prune -a -f

- name: GCC image
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.cpu'
push: true
target: 'gcc'
build-args: 'arch=gcc'
tags: 'zoeleibowitz/bases:cpu-gcc'
deploy-petsc:
name: "petsc"
needs: deploy-cpu-bases
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"
steps:
- name: Checkout devito
uses: actions/checkout@v4

- name: Check event name
run: echo ${{ github.event_name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile.devito
push: true
tags: petsc-dev
build-args: base=zoeleibowitz/bases:cpu-gcc

- name: Remove dangling layers
run: docker system prune -f

- name: Run tests
run: |
docker run ${{ matrix.flag }} --rm -t --name testrun 'devitocodes/devito:petsc-dev' pytest ${{ matrix.test }}
2 changes: 1 addition & 1 deletion docker/Dockerfile.devito
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
##############################################################

# Base image with compilers
ARG base=devitocodes/bases:cpu-gcc
ARG base=zoeleibowitz/bases:cpu-gcc
ARG petscinstall=""

FROM $base as copybase
Expand Down

0 comments on commit 9ef17eb

Please sign in to comment.