Docker Community Forums

Share and learn in the Docker community.

What is the difference between these dockerfile?


(Mark StoneLIA) #1

Dockerfile 1

FROM maven:3.5.4-jdk-8
ENV INSTALL_PATH=/opt
ENV HOME $INSTALL_PATH/apache-4
ENV PATH $PATH:$HOME/bin

ADD . $INSTALL_PATH
ADD working.tar /

RUN apt-get update &&
apt-get install -y locales-all &&
rm $MAVEN_HOME/conf/settings.xml &&
mv /workingdir/docker-entrypoint.sh / &&
mv /workingdir/settings.xml $MAVEN_HOME/conf/ &&
rm $KARAF_HOME/etc/org.ops4j.pax.url.mvn.cfg &&
mv /opt/workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/ &&
mv /workingdir/minimal/* $HOME/lib/ &&
mv /workingdir/reports/ $HOME/reports/ &&
mv /workingdir/config.properties $HOME/etc/ &&
mv /workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/ &&
mkdir /usr/local/share/fonts/ms_fonts &&
mv /opt/workingdir/reports/fonts/ /usr/local/share/fonts/ms_fonts/ &&
fc-cache -fv

ENV TZ=Europe/Rome
ENV LANG=en_US.UTF-8
ENV LC_CTYPE=“en_US.UTF-8”
ENV LC_COLLATE=“en_US.UTF-8”
ENV LC_MESSAGES=“en_US.UTF-8”
ENV LC_NUMERIC=it_IT.UTF-8
ENV LC_TIME=it_IT.UTF-8
ENV LC_MONETARY=it_IT.UTF-8
ENV LC_PAPER=it_IT.UTF-8
ENV LC_NAME=it_IT.UTF-8
ENV LC_ADDRESS=it_IT.UTF-8
ENV LC_TELEPHONE=it_IT.UTF-8
ENV LC_MEASUREMENT=it_IT.UTF-8
ENV LC_IDENTIFICATION=it_IT.UTF-8

WORKDIR $HOME/bin/

EXPOSE 1099
ENTRYPOINT ["/docker-entrypoint.sh"]

Dockerfile 2

FROM maven:3.5.4-jdk-8
ENV INSTALL_PATH=/opt
ENV HOME $INSTALL_PATH/apache-4
ENV PATH $PATH:$HOME/bin

RUN apt-get update &&
apt-get install -y locales-all

ENV TZ=Europe/Rome
ENV LANG=en_US.UTF-8
ENV LC_CTYPE=“en_US.UTF-8”
ENV LC_COLLATE=“en_US.UTF-8”
ENV LC_MESSAGES=“en_US.UTF-8”
ENV LC_NUMERIC=it_IT.UTF-8
ENV LC_TIME=it_IT.UTF-8
ENV LC_MONETARY=it_IT.UTF-8
ENV LC_PAPER=it_IT.UTF-8
ENV LC_NAME=it_IT.UTF-8
ENV LC_ADDRESS=it_IT.UTF-8
ENV LC_TELEPHONE=it_IT.UTF-8
ENV LC_MEASUREMENT=it_IT.UTF-8
ENV LC_IDENTIFICATION=it_IT.UTF-8

ARG dist="."

ADD $dist $INSTALL_PATH

COPY workingdir/docker-entrypoint.sh /

RUN rm $MAVEN_HOME/conf/settings.xml
COPY workingdir/settings.xml $MAVEN_HOME/conf/

RUN rm $HOME/etc/org.ops4j.pax.url.mvn.cfg
COPY workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/

COPY workingdir/minimal/ $HOME/lib/
COPY workingdir/reports/ $HOME/reports/
COPY workingdir/config.properties $HOME/etc/
RUN mkdir /usr/local/share/fonts/ms_fonts
COPY workingdir/reports/fonts/ /usr/local/share/fonts/ms_fonts/
RUN fc-cache -fv

COPY workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/

WORKDIR $HOME/bin/

EXPOSE 1099
ENTRYPOINT ["/docker-entrypoint.sh"]

Thank you


(Mikma) #2

It’s easier to compare when you have a diff.

--- dockerfile1 2019-02-14 14:47:38.773518534 +0100
+++ dockerfile2 2019-02-14 14:47:59.001573998 +0100
@@ -5,23 +5,8 @@
     ENV HOME $INSTALL_PATH/apache-4
     ENV PATH $PATH:$HOME/bin
 
-    ADD . $INSTALL_PATH
-    ADD working.tar /
-
     RUN apt-get update &&
-    apt-get install -y locales-all &&
-    rm $MAVEN_HOME/conf/settings.xml &&
-    mv /workingdir/docker-entrypoint.sh / &&
-    mv /workingdir/settings.xml $MAVEN_HOME/conf/ &&
-    rm $KARAF_HOME/etc/org.ops4j.pax.url.mvn.cfg &&
-    mv /opt/workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/ &&
-    mv /workingdir/minimal/* $HOME/lib/ &&
-    mv /workingdir/reports/ $HOME/reports/ &&
-    mv /workingdir/config.properties $HOME/etc/ &&
-    mv /workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/ &&
-    mkdir /usr/local/share/fonts/ms_fonts &&
-    mv /opt/workingdir/reports/fonts/ /usr/local/share/fonts/ms_fonts/ &&
-    fc-cache -fv
+    apt-get install -y locales-all
 
     ENV TZ=Europe/Rome
     ENV LANG=en_US.UTF-8
@@ -38,6 +23,27 @@
     ENV LC_MEASUREMENT=it_IT.UTF-8
     ENV LC_IDENTIFICATION=it_IT.UTF-8
 
+    ARG dist="."
+
+    ADD $dist $INSTALL_PATH
+
+    COPY workingdir/docker-entrypoint.sh /
+
+    RUN rm $MAVEN_HOME/conf/settings.xml
+    COPY workingdir/settings.xml $MAVEN_HOME/conf/
+
+    RUN rm $HOME/etc/org.ops4j.pax.url.mvn.cfg
+    COPY workingdir/org.ops4j.pax.url.mvn.cfg $HOME/etc/
+
     WORKDIR $HOME/bin/
 
     EXPOSE 1099