From: Marc Fehling Date: Thu, 28 Sep 2023 20:15:02 +0000 (-0600) Subject: Docker: Build images with different number of jobs. X-Git-Tag: relicensing~455^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe3df266f6da46fed8251239e9a38da07cca971d;p=dealii.git Docker: Build images with different number of jobs. --- diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index dca78dab4a..2fa82dbe86 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,7 +18,13 @@ jobs: strategy: fail-fast: false matrix: - ubuntu_version: ["focal", "jammy"] + ubuntu_version: [focal, jammy] + # Use 2 jobs to build, but only 1 for the focal image + # as it starves the github machine for memory. + include: + - n_jobs: 2 + - n_jobs: 1 + ubuntu_version: focal steps: - name: Checkout code @@ -42,7 +48,8 @@ jobs: cache-from: type=registry,ref=dealii/dependencies:${{ matrix.ubuntu_version }} cache-to: type=inline build-args: | - VER=master IMG=${{ matrix.ubuntu_version }} - push: ${{github.ref_name == 'master'}} + NJOBS=${{ matrix.n_jobs }} + VER=master + push: ${{ github.ref_name == 'master' }} tags: dealii/dealii:master-${{ matrix.ubuntu_version }} diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index c2a0570ca8..48936a5d89 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -1,12 +1,13 @@ -ARG IMG=focal +ARG IMG=focal # Ubuntu image that contains all corresponding dependencies. +ARG NJOBS=0 # Jobs used for building. Default: Use all available jobs. +ARG VER=master # deal.II branch that gets checked out. FROM dealii/dependencies:$IMG LABEL maintainer="luca.heltai@gmail.com" -ARG VER=master - USER root + RUN cd /usr/src && \ git clone https://github.com/dealii/dealii dealii-$VER && \ cd dealii-$VER && \ @@ -49,9 +50,9 @@ RUN cd /usr/src && \ -DDEAL_II_WITH_UMFPACK=ON \ -DDEAL_II_WITH_VTK=ON \ -DDEAL_II_WITH_ZLIB=ON \ - .. \ - && ninja -j 1 install \ - && cd ../ && rm -rf .git build + .. && \ + ninja -j $NJOBS install && \ + cd ../ && rm -rf .git build USER $USER WORKDIR $HOME