lordgamez commented on a change in pull request #882:
URL: https://github.com/apache/nifi-minifi-cpp/pull/882#discussion_r479630678



##########
File path: docker/Dockerfile
##########
@@ -54,44 +53,90 @@ RUN apk --update --no-cache upgrade && apk --update 
--no-cache add gcc \
        libressl-dev \
        zlib-dev \
        bzip2-dev \
-       python3-dev
+       python3-dev \
+       patch \
+       doxygen
 
 ENV USER minificpp
 ENV MINIFI_BASE_DIR /opt/minifi
+ENV JAVA_HOME /usr/lib/jvm/default-jvm
+ENV PATH ${PATH}:/usr/lib/jvm/default-jvm/bin
+ENV MINIFI_HOME $MINIFI_BASE_DIR/nifi-minifi-cpp-${MINIFI_VERSION}
 
 # Setup minificpp user
 RUN addgroup -g ${GID} ${USER} && adduser -u ${UID} -D -G ${USER} -g "" ${USER}
-RUN mkdir -p ${MINIFI_BASE_DIR}
-ENV JAVA_HOME /usr/lib/jvm/default-jvm
-ENV PATH ${PATH}:/usr/lib/jvm/default-jvm/bin
 
-ADD ${MINIFI_SOURCE_CODE} ${MINIFI_BASE_DIR}
-RUN chown -R ${USER}:${USER} ${MINIFI_BASE_DIR}
+RUN install -d -o ${USER} -g ${USER} ${MINIFI_BASE_DIR}
+COPY --chown=${USER}:${USER} ${MINIFI_SOURCE_CODE} ${MINIFI_BASE_DIR}
 
 USER ${USER}
 
-ENV MINIFI_HOME $MINIFI_BASE_DIR/nifi-minifi-cpp-${MINIFI_VERSION}
 
-# Perform the build
+# Build stage of the minimal image
+FROM build_deps AS build_minimal
+RUN cd ${MINIFI_BASE_DIR} \
+       && mkdir build \
+       && cd build \
+       && cmake -DDISABLE_LIBARCHIVE=ON -DDISABLE_SCRIPTING=ON 
-DENABLE_LIBRDKAFKA=ON -DSKIP_TESTS=true -DCMAKE_BUILD_TYPE=MinSizeRel .. \
+       && make -j$(nproc) package \
+       && tar -xzvf 
${MINIFI_BASE_DIR}/build/nifi-minifi-cpp-${MINIFI_VERSION}-bin.tar.gz -C 
${MINIFI_BASE_DIR}
+
+
+# Build stage of normal image
+FROM build_deps AS build_release
 RUN cd ${MINIFI_BASE_DIR} \
        && mkdir build \
        && cd build \
        && cmake -DDISABLE_JEMALLOC=ON -DSTATIC_BUILD= -DSKIP_TESTS=true 
-DENABLE_JNI=ON -DENABLE_LIBRDKAFKA=ON .. \
-       && make -j8 package \
+       && make -j$(nproc) package \
        && tar -xzvf 
${MINIFI_BASE_DIR}/build/nifi-minifi-cpp-${MINIFI_VERSION}-bin.tar.gz -C 
${MINIFI_BASE_DIR}
 
-# Second stage: the runtime image
+
+# Common runtime image dependencies
 # Edge required for rocksdb
-FROM alpine:3.8
+FROM alpine:3.12 AS common_runtime_deps
 
-ARG UID
-ARG GID
+ARG UID=1000
+ARG GID=1000
 ARG MINIFI_VERSION
 ARG MINIFI_SOURCE_CODE
 
 # Add testing repo for rocksdb
 RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> 
/etc/apk/repositories
 
+ENV USER minificpp
+ENV MINIFI_BASE_DIR /opt/minifi
+ENV MINIFI_HOME ${MINIFI_BASE_DIR}/minifi-current
+ENV MINIFI_VERSIONED_HOME ${MINIFI_BASE_DIR}/nifi-minifi-cpp-${MINIFI_VERSION}
+ENV JAVA_HOME /usr/lib/jvm/default-jvm
+ENV PATH ${PATH}:/usr/lib/jvm/default-jvm/bin
+
+RUN addgroup -g ${GID} ${USER} && adduser -u ${UID} -D -G ${USER} -g "" ${USER}
+RUN install -d -o ${USER} -g ${USER} ${MINIFI_BASE_DIR} \
+    && ln -s ${MINIFI_VERSIONED_HOME} ${MINIFI_HOME}
+
+
+# Final stage of the minimal image
+FROM common_runtime_deps AS minimal
+
+RUN apk --update --no-cache upgrade && apk add --update --no-cache libstdc++
+RUN install -d -o ${USER} -g ${USER} ${MINIFI_VERSIONED_HOME}/bin \
+    && install -d -o ${USER} -g ${USER} ${MINIFI_VERSIONED_HOME}/conf && chown 
${USER}:${USER} ${MINIFI_HOME}

Review comment:
       Thanks, nice catch I'll fix it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to