Dockerfile: Keep related build steps in one RUN call
It seems to be common sense to keep build steps (e.g.: configure, make, make install) in one RUN call ([1], [2]), if we follow the offical Dockerfiles ([3]).
[1] https://github.com/Perl/docker-perl/blob/master/5.028.000-slim/Dockerfile
[2] https://github.com/docker-library/ruby/blob/master/2.6-rc/stretch/Dockerfile
[3] https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#examples-for-official-repositories
Signed-off-by: Julien Hachenberger <julien.hachenberger@sit.fraunhofer.de>
diff --git a/Dockerfile b/Dockerfile
index 566658e..d6a9c85 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -20,10 +20,10 @@
&& tar xvf $openssl_name.tar.gz \
&& rm /tmp/$openssl_name.tar.gz
WORKDIR $openssl_name
-RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
-RUN make -j$(nproc)
-RUN make install
-RUN openssl version
+RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl \
+ && make -j$(nproc) \
+ && make install \
+ && openssl version
# IBM's Software TPM 2.0
ARG ibmtpm_name=ibmtpm1119
@@ -34,8 +34,8 @@
&& tar xvf $ibmtpm_name.tar.gz -C $ibmtpm_name \
&& rm $ibmtpm_name.tar.gz
WORKDIR $ibmtpm_name/src
-RUN CFLAGS="-I/usr/local/openssl/include" make -j$(nproc)
-RUN cp tpm_server /usr/local/bin
+RUN CFLAGS="-I/usr/local/openssl/include" make -j$(nproc) \
+ && cp tpm_server /usr/local/bin
RUN apt-get install -y \
libcmocka0 \
@@ -48,11 +48,11 @@
# TPM2-TSS
COPY . /tmp/tpm2-tss/
WORKDIR /tmp/tpm2-tss
-RUN ./bootstrap
-RUN ./configure --enable-unit
-RUN make -j$(nproc) check
-RUN make install
-RUN ldconfig
+RUN ./bootstrap \
+ && ./configure --enable-unit \
+ && make -j$(nproc) check \
+ && make install \
+ && ldconfig
ENV LD_LIBRARY_PATH /usr/local/lib
RUN cat test-suite.log