[ 
https://issues.apache.org/jira/browse/NIFI-4057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16046162#comment-16046162
 ] 

ASF GitHub Bot commented on NIFI-4057:
--------------------------------------

Github user cricket007 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1910#discussion_r121296054
  
    --- Diff: nifi-docker/dockerhub/Dockerfile ---
    @@ -16,37 +16,37 @@
     # under the License.
     #
     
    -FROM openjdk:8
    -MAINTAINER Apache NiFi <d...@nifi.apache.org>
    +FROM openjdk:8-jre
    +LABEL maintainer "Apache NiFi <d...@nifi.apache.org>"
     
     ARG UID=1000
    -ARG GID=50
     ARG NIFI_VERSION=1.4.0
    +ARG MIRROR=https://archive.apache.org/dist
     
    -ENV NIFI_BASE_DIR /opt/nifi
    -ENV NIFI_HOME $NIFI_BASE_DIR/nifi-$NIFI_VERSION
    -ENV NIFI_BINARY_URL 
https://archive.apache.org/dist/nifi/$NIFI_VERSION/nifi-$NIFI_VERSION-bin.tar.gz
    +ENV NIFI_BASE_DIR /opt/nifi 
    +ENV NIFI_HOME=$NIFI_BASE_DIR/nifi-$NIFI_VERSION \
    +    NIFI_BINARY_URL=/nifi/$NIFI_VERSION/nifi-$NIFI_VERSION-bin.tar.gz
     
     # Setup NiFi user
    -RUN groupadd -g $GID nifi || groupmod -n nifi `getent group $GID | cut -d: 
-f1`
    -RUN useradd --shell /bin/bash -u $UID -g $GID -m nifi
    -RUN mkdir -p $NIFI_HOME
    +RUN groupadd nifi && useradd nifi --shell /bin/bash -u $UID -m -g nifi  \
    +    && mkdir -p $NIFI_HOME/conf/templates && chown -R nifi:nifi 
$NIFI_BASE_DIR
    +
    +USER nifi
     
     # Download, validate, and expand Apache NiFi binary.
    -RUN curl -fSL $NIFI_BINARY_URL -o 
$NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz \
    -   && echo "$(curl $NIFI_BINARY_URL.sha256) 
*$NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz" | sha256sum -c - \
    +RUN curl -fSL $MIRROR/$NIFI_BINARY_URL -o 
$NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz \
    +   && echo "$(curl 
https://archive.apache.org/dist/$NIFI_BINARY_URL.sha256) 
*$NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz" | sha256sum -c - \
        && tar -xvzf $NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz -C 
$NIFI_BASE_DIR \
    -   && rm $NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz
    +   && rm $NIFI_BASE_DIR/nifi-$NIFI_VERSION-bin.tar.gz \
    +    && chown -R nifi:nifi $NIFI_HOME
     
    -RUN chown -R nifi:nifi $NIFI_HOME
    +# Web HTTP Port & Remote Site-to-Site Ports
    +EXPOSE 8080 8181
     
    -# Web HTTP Port
    -EXPOSE 8080
    +WORKDIR $NIFI_HOME
     
    -# Remote Site-To-Site Port
    -EXPOSE 8181
    -
    -USER nifi
    +VOLUME conf/templates
     
    --- End diff --
    
    Can that be an extended discussion elsewhere? While I might agree, at least 
for nifi.properties, the primary goal of this PR was to cut down the image 
size.  


> Docker Image is twice as large as necessary
> -------------------------------------------
>
>                 Key: NIFI-4057
>                 URL: https://issues.apache.org/jira/browse/NIFI-4057
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Docker
>    Affects Versions: 1.2.0, 1.3.0
>            Reporter: Jordan Moore
>            Priority: Minor
>
> By calling {{chown}} as a secondary {{RUN}} command, you effectively double 
> the size of image by creating a Docker layer of the same size as the 
> extracted binary. 
> See GitHub discussion: 
> https://github.com/apache/nifi/pull/1372#issuecomment-307592287
> *Expectation*
> The resultant Docker image should be no larger than the Base image + the size 
> required by extracting the Nifi binaries. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to