diff --git a/.github/workflows/pytest-petsc.yml b/.github/workflows/pytest-petsc.yml index ce74eceb4a..f541fb8872 100644 --- a/.github/workflows/pytest-petsc.yml +++ b/.github/workflows/pytest-petsc.yml @@ -54,16 +54,15 @@ jobs: - name: Build docker image run: | - docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=zoeleibowitz/bases:cpu-${{ matrix.arch }} --build-arg petscinstall=petsc - docker tag devito_img ${{ secrets.DOCKER_USERNAME }}/devito_img:latest + docker build -f docker/Dockerfile.devito --build-arg base=zoeleibowitz/petsc_image:latest --tag zoeleibowitz/petsc_devito_image:latest . - name: Push Docker image to DockerHub run: | - docker push ${{ secrets.DOCKER_USERNAME }}/devito_img:latest + docker push ${{ secrets.DOCKER_USERNAME }}/petsc_devito_image:latest - name: Set run prefix run: | - echo "RUN_CMD=docker run --rm -t -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV + echo "RUN_CMD=docker run --rm -t -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun zoeleibowitz/petsc_devito_image:latest" >> $GITHUB_ENV id: set-run - name: Set tests diff --git a/docker/Dockerfile.devito b/docker/Dockerfile.devito index ba41309fd9..8e4148555e 100644 --- a/docker/Dockerfile.devito +++ b/docker/Dockerfile.devito @@ -4,26 +4,8 @@ # Base image with compilers ARG base=devitocodes/bases:cpu-gcc -ARG petscinstall="" -FROM $base AS copybase - -################## Install PETSc ############################################ -FROM copybase AS petsccopybase - -RUN apt-get update && apt-get install -y git && \ - python3 -m venv /venv && \ - /venv/bin/pip install --no-cache-dir --upgrade pip && \ - /venv/bin/pip install --no-cache-dir --no-binary numpy numpy && \ - mkdir -p /opt/petsc && \ - cd /opt/petsc && \ - git clone -b release https://gitlab.com/petsc/petsc.git petsc && \ - cd petsc && \ - ./configure --with-fortran-bindings=0 --with-mpi-dir=/opt/openmpi --with-openblas-include=$(pkg-config --variable=includedir openblas) --with-openblas-lib=$(pkg-config --variable=libdir openblas)/libopenblas.so PETSC_ARCH=devito_build && \ - make all - -ARG petscinstall="" -FROM ${petscinstall}copybase AS builder +FROM $base AS builder # User/Group Ids ARG USER_ID=1000 @@ -87,9 +69,6 @@ ARG GROUP_ID=1000 ENV HOME=/app ENV APP_HOME=/app -ENV PETSC_ARCH="devito_build" -ENV PETSC_DIR="/opt/petsc/petsc" - # Create the home directory for the new app user. # Create an app user so our program doesn't run as root. # Chown all the files to the app user. diff --git a/docker/Dockerfile.petsc b/docker/Dockerfile.petsc new file mode 100644 index 0000000000..6bf0800a8e --- /dev/null +++ b/docker/Dockerfile.petsc @@ -0,0 +1,25 @@ +############################################################## +# Dockerfile.petsc: Installs PETSc +############################################################## + +# Base image with compilers +# TODO: to be updated, but made some additions to Dockerfile.cpu so need to +# use the one from my dockerhub +ARG base=zoeleibowitz/bases:cpu-gcc + +RUN apt-get update && apt-get install -y git && \ + python3 -m venv /venv && \ + /venv/bin/pip install --no-cache-dir --upgrade pip && \ + /venv/bin/pip install --no-cache-dir --no-binary numpy numpy && \ + mkdir -p /opt/petsc && \ + cd /opt/petsc && \ + git clone -b release https://gitlab.com/petsc/petsc.git petsc && \ + cd petsc && \ + ./configure --with-fortran-bindings=0 --with-mpi-dir=/opt/openmpi \ + --with-openblas-include=$(pkg-config --variable=includedir openblas) \ + --with-openblas-lib=$(pkg-config --variable=libdir openblas)/libopenblas.so \ + PETSC_ARCH=devito_build && \ + make all + +ENV PETSC_DIR="/opt/petsc/petsc" +ENV PETSC_ARCH="devito_build"