]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Docker: Build images with different number of jobs. 16062/head
authorMarc Fehling <mafehling.git@gmail.com>
Thu, 28 Sep 2023 20:15:02 +0000 (14:15 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Thu, 28 Sep 2023 20:29:39 +0000 (14:29 -0600)
.github/workflows/docker.yml
contrib/docker/Dockerfile

index dca78dab4af3f82c936cb820401a9d253c43e223..2fa82dbe8654a828c64df8669b7ffdae721427ab 100644 (file)
@@ -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 }}
index c2a0570ca8158f5382c1ee5bb5805e3bfc26f416..48936a5d8950ab7235f66f5e04e9fa8b7611697f 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.