docker/fvp: use multi-stage approach and other minor changes
Changes include: 1. create a multi-stage image, first image for
installing FVP dependencies and second image from model installation
2. Avoid mkdir on MODEL_DIR 3. Include comment about fvp models: some models
contain an installer and some do not 4. Run the installer together with '||
True', avoiding a failure in case tarball does not come with an
installer 5. Remove installer if present.
An example of the produced dockerfiles from this new approach, can be
seen at [1].
[1] https://review.trustedfirmware.org/c/ci/dockerfiles/+/9109
Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
Change-Id: I1c5e67c636a6b36556c81be1407eccaa58395fe0
diff --git a/script/docker/fvp/dockerfile-template b/script/docker/fvp/dockerfile-template
index e124865..5803557 100644
--- a/script/docker/fvp/dockerfile-template
+++ b/script/docker/fvp/dockerfile-template
@@ -1,23 +1,20 @@
-FROM ${OS}:${OS_VER}
+FROM ${OS}:${OS_VER} as FVP
-ENV ARMLMD_LICENSE_FILE=27000@ci.trustedfirmware.org
-
-# Install package required
RUN apt-get update && \
apt-get install --no-install-recommends --yes bc libatomic1 telnet libdbus-1-3 xterm && \
rm -rf /var/cache/apt
-# Create model directory
-RUN mkdir ${MODEL_DIR}
+FROM FVP
-# Add FVP Binaries
-ADD ${MODEL}_${MODEL_VER}.tgz ${MODEL_DIR}
+WORKDIR ${MODEL_DIR}
-# Install the model
-RUN cd ${MODEL_DIR} && \
- ${MODEL_DIR}/${MODEL}.sh \
+# Add the FVP model tarball
+# NOTE: some tarballs contain an installer script others don't, so it may be the case
+# that the ADD instruction do install the model under /opt/model
+ADD ${MODEL}_${MODEL_VER}.tgz .
+
+# Install packages and model
+RUN ${MODEL_DIR}/${MODEL}.sh \
--i-agree-to-the-contained-eula \
--verbose \
- --destination ${MODEL_DIR}/${MODEL}
-
-WORKDIR /opt/model/${MODEL}/models/Linux64_GCC-6.4/
\ No newline at end of file
+ --destination ${MODEL_DIR}/${MODEL} && rm -f ${MODEL_DIR}/${MODEL}.sh || true