Currently, we use ubuntu:18.04 and ubuntu:16.04 as a basis for building our different precice images. This approach is slow and has quite some code duplication. I would propose to provide a dockerimages precice-dependencies:18.04 and precice-dependencies:16.04 that comes with the minimal dependencies and that are built nightly.
In the following a rough draft of what I have in mind:
Dockerfile for precice-dependencies:16.04
# Using ubuntu 16.04 as basis
FROM ubuntu:16.04
# Installing necessary dependacies for preCICE
RUN apt-get -qq update && apt-get -qq install \
build-essential \
....
# Installing cmake
....
# Installing boost from source
....
# create user precice
....
Modified precice/Dockerfile.Ubuntu1604.home
FROM precice-dependencies:16.04
# Building preCICE
...
How does this help us?
We build precice-dependencies nightly and reuse it in the different precice images. This should be sufficient to ensure compatibility.
precice images are still built on every commit, but we safe the time that usually is needed for installing the dependencies.
We reduce code duplication due to reuse of precice-dependencies in several precice images. (precice-dependencies:16.04 may be used by all precice images that are based on ubuntu:16.04)
Currently, we use
ubuntu:18.04
andubuntu:16.04
as a basis for building our differentprecice
images. This approach is slow and has quite some code duplication. I would propose to provide a dockerimagesprecice-dependencies:18.04
andprecice-dependencies:16.04
that comes with the minimal dependencies and that are built nightly.Example of current state
Let's look at the example file Dockerfile.Ubuntu1604.home:
https://github.com/precice/systemtests/blob/ff457bed2521c9ab78f7f6e490c7785219151c1e/precice/Dockerfile.Ubuntu1604.home#L3-L4
A large part of the time is spent installing dependencies:
https://github.com/precice/systemtests/blob/ff457bed2521c9ab78f7f6e490c7785219151c1e/precice/Dockerfile.Ubuntu1604.home#L6-L31
Additionally, we are configuring our environment:
https://github.com/precice/systemtests/blob/ff457bed2521c9ab78f7f6e490c7785219151c1e/precice/Dockerfile.Ubuntu1604.home#L33-L42
These steps are very similar for most files in
systemtests/precice/
. Therefore, I would propose to factor them out into a common baseimage.The "interesting" part comes later, when we actually build preCICE:
https://github.com/precice/systemtests/blob/ff457bed2521c9ab78f7f6e490c7785219151c1e/precice/Dockerfile.Ubuntu1604.home#L44-L83
Build and use
precice-dependencies:18.04
In the following a rough draft of what I have in mind:
Dockerfile for
precice-dependencies:16.04
Modified
precice/Dockerfile.Ubuntu1604.home
How does this help us?
precice-dependencies
nightly and reuse it in the differentprecice
images. This should be sufficient to ensure compatibility.precice
images are still built on every commit, but we safe the time that usually is needed for installing the dependencies.precice-dependencies
in severalprecice
images. (precice-dependencies:16.04
may be used by allprecice
images that are based onubuntu:16.04
)