From 78f206a811531c1dfcd3edc9fceb6cce7d0cc594 Mon Sep 17 00:00:00 2001 From: Kevin Doran Date: Wed, 16 Nov 2022 23:03:15 -0500 Subject: [PATCH] NIFI-10820 Change Docker base image to eclipse-temurin NIFI-9656 Change Docker images to use Java 11 This closes #6673 Signed-off-by: Chris Sampson Signed-off-by: David Handermann --- .../minifi-c2-docker/dockerhub/Dockerfile | 25 +++--- .../minifi-c2-docker/dockermaven/Dockerfile | 30 ++++--- minifi/minifi-c2/minifi-c2-docker/pom.xml | 58 +++++++------ minifi/minifi-docker/dockerhub/Dockerfile | 24 +++--- minifi/minifi-docker/dockermaven/Dockerfile | 30 ++++--- minifi/minifi-docker/pom.xml | 81 ++++++++++++------- nifi-docker/dockerhub/Dockerfile | 11 ++- nifi-docker/dockerhub/README.md | 6 ++ nifi-docker/dockerhub/pom.xml | 5 +- nifi-docker/dockermaven/Dockerfile | 14 +++- nifi-docker/dockermaven/integration-test.sh | 4 +- nifi-docker/dockermaven/pom.xml | 12 +-- nifi-docker/pom.xml | 27 +------ .../nifi-registry-docker/dockerhub/Dockerfile | 12 ++- .../dockermaven/Dockerfile | 16 ++-- .../dockermaven/integration-test.sh | 11 ++- .../dockermaven/pom.xml | 5 -- .../nifi-toolkit-assembly/docker/Dockerfile | 37 +++++---- .../docker/Dockerfile.hub | 20 +++-- .../docker/sh/docker-entrypoint.sh | 4 +- nifi-toolkit/nifi-toolkit-assembly/pom.xml | 10 +-- pom.xml | 13 +++ 22 files changed, 262 insertions(+), 193 deletions(-) diff --git a/minifi/minifi-c2/minifi-c2-docker/dockerhub/Dockerfile b/minifi/minifi-c2/minifi-c2-docker/dockerhub/Dockerfile index 1b98775d8d..e83e3426d2 100644 --- a/minifi/minifi-c2/minifi-c2-docker/dockerhub/Dockerfile +++ b/minifi/minifi-c2/minifi-c2-docker/dockerhub/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -FROM eclipse-temurin:8-jre +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi " LABEL site="https://nifi.apache.org" @@ -26,31 +26,32 @@ ARG MINIFI_C2_VERSION=1.19.0 ARG MIRROR=https://archive.apache.org/dist ENV MINIFI_C2_BASE_DIR /opt/minifi-c2 -ENV MINIFI_C2_HOME ${MINIFI_C2_BASE_DIR}/minifi-c2-${MINIFI_C2_VERSION} +ENV MINIFI_C2_HOME ${MINIFI_C2_BASE_DIR}/minifi-c2-current ENV MINIFI_C2_BINARY minifi-c2-${MINIFI_C2_VERSION}-bin.zip ENV MINIFI_C2_BINARY_PATH nifi/${MINIFI_C2_VERSION}/${MINIFI_C2_BINARY} ENV MINIFI_C2_BINARY_URL ${MIRROR}/${MINIFI_C2_BINARY_PATH} -# Setup MiNiFi user -RUN addgroup -gid $GID c2 || groupmod -n c2 $(getent group $GID | cut -d: -f1) -RUN useradd -r -g c2 c2 -RUN mkdir -p $MINIFI_C2_HOME +RUN mkdir -p ${MINIFI_C2_BASE_DIR} # Download, validate, and expand Apache MiNiFi C2 binary. RUN apt-get update \ && apt-get install -y zip \ && rm -rf /var/lib/apt/lists/* \ && curl -fSL $MINIFI_C2_BINARY_URL -o $MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY} \ - && echo "$(curl $MINIFI_C2_BINARY_URL.sha256) *$MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY}" | sha256sum -c - \ - && unzip $MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY} -d $MINIFI_C2_BASE_DIR \ - && rm $MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY} - -RUN chown -R c2:c2 $MINIFI_C2_HOME + && echo "$(curl $MINIFI_C2_BINARY_URL.sha256) *$MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY}" | sha256sum -c - \ + && unzip $MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY} -d $MINIFI_C2_BASE_DIR \ + && rm $MINIFI_C2_BASE_DIR/${MINIFI_C2_BINARY} \ + && groupadd -g ${GID} c2 \ + && useradd --shell /bin/bash -u ${UID} -g ${GID} -m c2 \ + && ln -s ${MINIFI_C2_BASE_DIR}/minifi-c2-${MINIFI_C2_VERSION} $MINIFI_C2_HOME \ + && chown -R -L c2:c2 ${MINIFI_C2_BASE_DIR} USER c2 #Default http port EXPOSE 10090 +WORKDIR ${MINIFI_C2_HOME} + # Startup MiNiFi C2 -CMD $MINIFI_C2_HOME/bin/c2.sh +ENTRYPOINT ["./bin/c2.sh", "run"] diff --git a/minifi/minifi-c2/minifi-c2-docker/dockermaven/Dockerfile b/minifi/minifi-c2/minifi-c2-docker/dockermaven/Dockerfile index db5344d7eb..754a1ed72f 100644 --- a/minifi/minifi-c2/minifi-c2-docker/dockermaven/Dockerfile +++ b/minifi/minifi-c2/minifi-c2-docker/dockermaven/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -FROM eclipse-temurin:8-jre +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi " LABEL site="https://nifi.apache.org" @@ -26,20 +26,30 @@ ARG MINIFI_C2_VERSION ARG MINIFI_C2_BINARY ENV MINIFI_C2_BASE_DIR /opt/minifi-c2 -ENV MINIFI_C2_HOME $MINIFI_C2_BASE_DIR/minifi-c2-$MINIFI_C2_VERSION +ENV MINIFI_C2_BINARY_NAME minifi-c2-${MINIFI_C2_VERSION}-bin.zip +ENV MINIFI_C2_HOME ${MINIFI_C2_BASE_DIR}/minifi-c2-current -# Setup MiNiFi C2 user -RUN addgroup -gid $GID c2 || groupmod -n c2 $(getent group $GID | cut -d: -f1) -RUN useradd -r -g c2 c2 -RUN mkdir -p $MINIFI_C2_HOME +RUN mkdir -p ${MINIFI_C2_BASE_DIR} +COPY $MINIFI_C2_BINARY $MINIFI_C2_BASE_DIR -ADD $MINIFI_C2_BINARY $MINIFI_C2_BASE_DIR -RUN chown -R c2:c2 $MINIFI_C2_HOME +RUN apt-get update \ + && apt-get install -y unzip \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && unzip ${MINIFI_C2_BASE_DIR}/${MINIFI_C2_BINARY_NAME} -d ${MINIFI_C2_BASE_DIR} \ + && rm ${MINIFI_C2_BASE_DIR}/${MINIFI_C2_BINARY_NAME} \ + && groupadd -g ${GID} c2 \ + && useradd --shell /bin/bash -u ${UID} -g ${GID} -m c2 \ + && ln -s $MINIFI_C2_BASE_DIR/minifi-c2-$MINIFI_C2_VERSION $MINIFI_C2_HOME \ + && chown -R -L c2:c2 ${MINIFI_C2_BASE_DIR} USER c2 #Default http port EXPOSE 10090 -# Startup MiNiFi c2 -CMD $MINIFI_C2_HOME/bin/c2.sh run +WORKDIR ${MINIFI_C2_HOME} + +# Startup MiNiFi C2 +ENTRYPOINT ["./bin/c2.sh", "run"] diff --git a/minifi/minifi-c2/minifi-c2-docker/pom.xml b/minifi/minifi-c2/minifi-c2-docker/pom.xml index e4b593ea4e..ab111c3623 100644 --- a/minifi/minifi-c2/minifi-c2-docker/pom.xml +++ b/minifi/minifi-c2/minifi-c2-docker/pom.xml @@ -40,37 +40,45 @@ limitations under the License. - com.spotify - docker-maven-plugin - 0.4.13 + maven-antrun-plugin + 3.0.0 - package + copy-assembly-for-docker - build + run + process-sources + + + + + + + + + + + + + + com.spotify + dockerfile-maven-plugin + + + + dockermaven/Dockerfile + + 1000 + 1000 + ${minifi.c2.version} + target/minifi-c2-${minifi.c2.version}-bin.zip + + apacheminific2 + ${minifi.c2.version} + - - apacheminific2 - ${project.basedir}/dockermaven - - ${minifi.c2.version} - - - 1000 - 1000 - ${minifi.c2.version} - minifi-c2-${minifi.c2.version}-bin.tar.gz - - - - / - ${project.basedir}/../minifi-c2-assembly/target - minifi-c2-${minifi.c2.version}-bin.tar.gz - - - diff --git a/minifi/minifi-docker/dockerhub/Dockerfile b/minifi/minifi-docker/dockerhub/Dockerfile index c38573a11f..a710ceb528 100644 --- a/minifi/minifi-docker/dockerhub/Dockerfile +++ b/minifi/minifi-docker/dockerhub/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -FROM eclipse-temurin:8-jre +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi " LABEL site="https://nifi.apache.org" @@ -31,11 +31,7 @@ ENV MINIFI_BINARY minifi-${MINIFI_VERSION}-bin.zip ENV MINIFI_BINARY_PATH nifi/${MINIFI_VERSION}/${MINIFI_BINARY} ENV MINIFI_BINARY_URL ${MIRROR}/${MINIFI_BINARY_PATH} -# Setup MiNiFi user -RUN addgroup -gid $GID minifi || groupmod -n minifi $(getent group $GID | cut -d: -f1) -RUN useradd -r -g minifi minifi RUN mkdir -p $MINIFI_BASE_DIR - ADD sh/ ${MINIFI_BASE_DIR}/scripts/ # Download, validate, and expand Apache MiNiFi binary. @@ -43,14 +39,18 @@ RUN apt-get update \ && apt-get install -y zip \ && rm -rf /var/lib/apt/lists/* \ && curl -fSL $MINIFI_BINARY_URL -o $MINIFI_BASE_DIR/${MINIFI_BINARY} \ - && echo "$(curl $MINIFI_BINARY_URL.sha256) *$MINIFI_BASE_DIR/${MINIFI_BINARY}" | sha256sum -c - \ - && unzip $MINIFI_BASE_DIR/${MINIFI_BINARY} -d $MINIFI_BASE_DIR \ - && rm $MINIFI_BASE_DIR/${MINIFI_BINARY} \ - && ln -s $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION $MINIFI_HOME - -RUN chown -R -L minifi:minifi $MINIFI_HOME + && echo "$(curl $MINIFI_BINARY_URL.sha256) *$MINIFI_BASE_DIR/${MINIFI_BINARY}" | sha256sum -c - \ + && unzip $MINIFI_BASE_DIR/${MINIFI_BINARY} -d $MINIFI_BASE_DIR \ + && rm $MINIFI_BASE_DIR/${MINIFI_BINARY} \ + && groupadd -g ${GID} minifi \ + && useradd --shell /bin/bash -u ${UID} -g ${GID} -m minifi \ + && ln -s $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION $MINIFI_HOME \ + && chown -R -L minifi:minifi ${MINIFI_BASE_DIR} \ + && chmod -R +x ${MINIFI_BASE_DIR}/scripts/*.sh USER minifi +WORKDIR ${MINIFI_HOME} + # Startup MiNiFi -CMD ${MINIFI_BASE_DIR}/scripts/start.sh +ENTRYPOINT ["../scripts/start.sh"] diff --git a/minifi/minifi-docker/dockermaven/Dockerfile b/minifi/minifi-docker/dockermaven/Dockerfile index 255f35a3ec..7d8e947d2f 100644 --- a/minifi/minifi-docker/dockermaven/Dockerfile +++ b/minifi/minifi-docker/dockermaven/Dockerfile @@ -17,7 +17,7 @@ # ARG IMAGE_NAME=eclipse-temurin -ARG IMAGE_TAG=8-jre +ARG IMAGE_TAG=11-jre FROM ${IMAGE_NAME}:${IMAGE_TAG} LABEL maintainer="Apache NiFi " LABEL site="https://nifi.apache.org" @@ -27,20 +27,32 @@ ARG UID ARG GID ARG MINIFI_VERSION ARG MINIFI_BINARY +ARG MINIFI_SCRIPTS ENV MINIFI_BASE_DIR /opt/minifi +ENV MINIFI_BINARY_NAME minifi-${MINIFI_VERSION}-bin.zip ENV MINIFI_HOME $MINIFI_BASE_DIR/minifi-current -# Setup MiNiFi user -RUN addgroup -gid $GID minifi || groupmod -n minifi $(getent group $GID | cut -d: -f1) -RUN useradd -r -g minifi minifi -RUN mkdir -p $MINIFI_BASE_DIR +RUN mkdir -p $MINIFI_BASE_DIR +COPY $MINIFI_BINARY $MINIFI_BASE_DIR +ADD $MINIFI_SCRIPTS ${MINIFI_BASE_DIR}/scripts -ADD $MINIFI_BINARY $MINIFI_BASE_DIR -RUN ln -s $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION $MINIFI_HOME -RUN chown -R -L minifi:minifi $MINIFI_HOME +RUN apt-get update \ + && apt-get install -y unzip \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && unzip ${MINIFI_BASE_DIR}/${MINIFI_BINARY_NAME} -d ${MINIFI_BASE_DIR} \ + && rm ${MINIFI_BASE_DIR}/${MINIFI_BINARY_NAME} \ + && groupadd -g ${GID} minifi \ + && useradd --shell /bin/bash -u ${UID} -g ${GID} -m minifi \ + && ln -s $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION $MINIFI_HOME \ + && chown -R -L minifi:minifi $MINIFI_BASE_DIR \ + && chmod -R +x ${MINIFI_BASE_DIR}/scripts/*.sh USER minifi +WORKDIR ${MINIFI_HOME} + # Startup MiNiFi -CMD $MINIFI_HOME/bin/minifi.sh run +ENTRYPOINT ["../scripts/start.sh"] diff --git a/minifi/minifi-docker/pom.xml b/minifi/minifi-docker/pom.xml index 54b0b56ed5..1ad4f31aa4 100644 --- a/minifi/minifi-docker/pom.xml +++ b/minifi/minifi-docker/pom.xml @@ -31,7 +31,7 @@ limitations under the License. ${project.version} eclipse-temurin - 8-jre + 11-jre @@ -41,39 +41,64 @@ limitations under the License. - com.spotify - docker-maven-plugin - 0.4.13 + maven-antrun-plugin + 3.0.0 - package + copy-scripts-for-docker + process-sources + + + + + + + + + - build + run + + + + copy-assembly-for-docker + process-sources + + + + + + + + + + + run - - apacheminifi - ${project.basedir}/dockermaven - - ${minifi.version} - - - ${docker.image.name} - ${docker.image.tag} - 1000 - 1000 - ${minifi.version} - minifi-${minifi.version}-bin.tar.gz - - - - / - ${project.basedir}/../minifi-assembly/target - minifi-${minifi.version}-bin.tar.gz - - - + + + com.spotify + dockerfile-maven-plugin + + + + dockermaven/Dockerfile + + ${docker.image.name} + ${docker.image.tag} + 1000 + 1000 + ${minifi.version} + target/minifi-${minifi.version}-bin.zip + target/sh + + apacheminifi + ${minifi.version} + + + diff --git a/nifi-docker/dockerhub/Dockerfile b/nifi-docker/dockerhub/Dockerfile index 57bb63c3ba..41bd14d7d4 100644 --- a/nifi-docker/dockerhub/Dockerfile +++ b/nifi-docker/dockerhub/Dockerfile @@ -15,8 +15,9 @@ # specific language governing permissions and limitations # under the License. # -ARG IMAGE_NAME=openjdk -ARG IMAGE_TAG=8-jre + +ARG IMAGE_NAME=eclipse-temurin +ARG IMAGE_TAG=11-jre FROM ${IMAGE_NAME}:${IMAGE_TAG} ARG MAINTAINER="Apache NiFi " LABEL maintainer="${MAINTAINER}" @@ -34,7 +35,6 @@ ARG NIFI_TOOLKIT_BINARY_PATH=${NIFI_TOOLKIT_BINARY_PATH:-/nifi/${DISTRO_PATH}/ni ENV NIFI_BASE_DIR=/opt/nifi ENV NIFI_HOME ${NIFI_BASE_DIR}/nifi-current ENV NIFI_TOOLKIT_HOME ${NIFI_BASE_DIR}/nifi-toolkit-current - ENV NIFI_PID_DIR=${NIFI_HOME}/run ENV NIFI_LOG_DIR=${NIFI_HOME}/logs @@ -47,7 +47,10 @@ RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: - && mkdir -p ${NIFI_BASE_DIR} \ && chown -R nifi:nifi ${NIFI_BASE_DIR} \ && apt-get update \ - && apt-get install -y jq xmlstarlet procps + && apt-get install -y jq xmlstarlet procps unzip \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* USER nifi diff --git a/nifi-docker/dockerhub/README.md b/nifi-docker/dockerhub/README.md index 4de8396471..1b6b9f76bf 100644 --- a/nifi-docker/dockerhub/README.md +++ b/nifi-docker/dockerhub/README.md @@ -15,6 +15,12 @@ ## Latest changes +### 1.19.0 + +- Changed base image to eclipse-temurin:11-jre as openjdk:8-jre is no longer maintained +- This also change the image to use Java 11 instead of Java 8 +- As a benefit, the NiFi image now supports arm64 platforms in addition to amd64/x86_64 + ### 1.14.0 - Updated default container configuration to use HTTPS with Single User Authentication diff --git a/nifi-docker/dockerhub/pom.xml b/nifi-docker/dockerhub/pom.xml index 4fc3c4cabe..f4c33ee563 100644 --- a/nifi-docker/dockerhub/pom.xml +++ b/nifi-docker/dockerhub/pom.xml @@ -21,12 +21,9 @@ dockerhub - openjdk - 8-jre - ]]> - 1.14.0 + 1.19.0 diff --git a/nifi-docker/dockermaven/Dockerfile b/nifi-docker/dockermaven/Dockerfile index 2bd31d0e08..15a524c738 100644 --- a/nifi-docker/dockermaven/Dockerfile +++ b/nifi-docker/dockermaven/Dockerfile @@ -16,11 +16,12 @@ # under the License. # -ARG IMAGE_NAME=openjdk -ARG IMAGE_TAG=8-jre +ARG IMAGE_NAME=eclipse-temurin +ARG IMAGE_TAG=11-jre FROM ${IMAGE_NAME}:${IMAGE_TAG} AS artifactbase ARG MAINTAINER="Apache NiFi " LABEL maintainer="${MAINTAINER}" +LABEL site="https://nifi.apache.org" ARG NIFI_VERSION ARG NIFI_BINARY @@ -34,7 +35,9 @@ ENV NIFI_PID_DIR=${NIFI_HOME}/run ENV NIFI_LOG_DIR=${NIFI_HOME}/logs ADD ${NIFI_SCRIPTS} ${NIFI_BASE_DIR}/scripts/ -RUN chmod -R +x ${NIFI_BASE_DIR}/scripts/*.sh +RUN chmod -R +x ${NIFI_BASE_DIR}/scripts/*.sh \ + && apt-get update \ + && apt-get install -y unzip COPY $NIFI_BINARY $NIFI_BASE_DIR RUN unzip ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.zip -d ${NIFI_BASE_DIR} \ @@ -74,7 +77,10 @@ ENV NIFI_LOG_DIR=${NIFI_HOME}/logs RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \ && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ && apt-get update \ - && apt-get install -y jq xmlstarlet procps + && apt-get install -y jq xmlstarlet procps \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* COPY --chown=nifi:nifi --from=artifactbase $NIFI_BASE_DIR $NIFI_BASE_DIR diff --git a/nifi-docker/dockermaven/integration-test.sh b/nifi-docker/dockermaven/integration-test.sh index 726d89c465..e0d481efde 100755 --- a/nifi-docker/dockermaven/integration-test.sh +++ b/nifi-docker/dockermaven/integration-test.sh @@ -21,10 +21,10 @@ TAG=$1 VERSION=$2 -trap '{ docker ps -qaf Name="nifi-${TAG}-integration-test" | xargs --no-run-if-empty docker rm -f; }' EXIT +trap '{ docker rm -f nifi-${TAG}-integration-test; }' EXIT echo "Deleting any existing nifi-${TAG}-integration-test containers" -docker ps -qaf Name="nifi-${TAG}-integration-test" | xargs --no-run-if-empty docker rm -f; +docker rm -f nifi-${TAG}-integration-test; echo "Checking that all files are owned by NiFi" test -z "$(docker run --rm --entrypoint /bin/bash "apache/nifi:${TAG}" -c "find /opt/nifi ! -user nifi")" diff --git a/nifi-docker/dockermaven/pom.xml b/nifi-docker/dockermaven/pom.xml index e6ac6c06df..0259fcafa7 100644 --- a/nifi-docker/dockermaven/pom.xml +++ b/nifi-docker/dockermaven/pom.xml @@ -20,12 +20,6 @@ dockermaven - - openjdk - 8-jre - ]]> - - docker @@ -71,7 +65,7 @@ 3.0.0 - copy-sh-for-docker + copy-scripts-for-docker process-sources @@ -87,7 +81,7 @@ - copy-for-docker + copy-nifi-assembly-for-docker process-sources @@ -103,7 +97,7 @@ - copy-toolkit-for-docker + copy-nifi-toolkit-assembly-for-docker process-sources diff --git a/nifi-docker/pom.xml b/nifi-docker/pom.xml index 02af55b07e..093ed6c345 100644 --- a/nifi-docker/pom.xml +++ b/nifi-docker/pom.xml @@ -23,6 +23,9 @@ language governing permissions and limitations under the License. --> ${project.version} + eclipse-temurin + 11-jre + ]]> @@ -30,28 +33,4 @@ language governing permissions and limitations under the License. --> dockerhub - - - - - com.spotify - dockerfile-maven-plugin - 1.4.13 - - - default - - build - push - - - - - ${nifi.version} - - - - - - diff --git a/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/Dockerfile b/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/Dockerfile index 1e8cd3d82a..59a38139de 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/Dockerfile +++ b/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/Dockerfile @@ -16,13 +16,13 @@ # under the License. # -FROM openjdk:8-jdk-slim +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi " LABEL site="https://nifi.apache.org" ARG UID=1000 ARG GID=1000 -ARG NIFI_REGISTRY_VERSION=1.17.0 +ARG NIFI_REGISTRY_VERSION=1.19.0 ARG MIRROR=https://archive.apache.org/dist ENV NIFI_REGISTRY_BASE_DIR /opt/nifi-registry @@ -32,13 +32,17 @@ ENV NIFI_REGISTRY_BINARY_PATH nifi/${NIFI_REGISTRY_VERSION}/${NIFI_REGISTRY_BINA ENV NIFI_REGISTRY_BINARY_URL ${MIRROR}/${NIFI_REGISTRY_BINARY_PATH} ADD sh/ ${NIFI_REGISTRY_BASE_DIR}/scripts/ +RUN chmod -R +x ${NIFI_REGISTRY_BASE_DIR}/scripts/*.sh # Setup NiFi-Registry user RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \ && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ && chown -R nifi:nifi ${NIFI_REGISTRY_BASE_DIR} \ && apt-get update -y \ - && apt-get install -y curl jq xmlstarlet unzip + && apt-get install -y curl jq xmlstarlet unzip \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* USER nifi @@ -57,4 +61,4 @@ EXPOSE 18080 18443 WORKDIR ${NIFI_REGISTRY_HOME} # Apply configuration and start NiFi Registry -CMD ${NIFI_REGISTRY_BASE_DIR}/scripts/start.sh +ENTRYPOINT ["../scripts/start.sh"] \ No newline at end of file diff --git a/nifi-registry/nifi-registry-docker-maven/dockermaven/Dockerfile b/nifi-registry/nifi-registry-docker-maven/dockermaven/Dockerfile index 74beb59be8..e097ef303b 100644 --- a/nifi-registry/nifi-registry-docker-maven/dockermaven/Dockerfile +++ b/nifi-registry/nifi-registry-docker-maven/dockermaven/Dockerfile @@ -16,16 +16,20 @@ # under the License. # -FROM openjdk:8-jre AS artifactbase +FROM eclipse-temurin:11-jre AS artifactbase LABEL maintainer="Apache NiFi " +LABEL site="https://nifi.apache.org" ARG NIFI_REGISTRY_BINARY -ARG NIFI_REGISTRY_VERSION=1.14.0 +ARG NIFI_REGISTRY_VERSION=1.19.0 ENV NIFI_REGISTRY_BASE_DIR /opt/nifi-registry ENV NIFI_REGISTRY_HOME ${NIFI_REGISTRY_BASE_DIR}/nifi-registry-current ADD sh/ ${NIFI_REGISTRY_BASE_DIR}/scripts/ +RUN chmod -R +x ${NIFI_REGISTRY_BASE_DIR}/scripts/*.sh \ + && apt-get update \ + && apt-get install -y unzip COPY $NIFI_REGISTRY_BINARY $NIFI_REGISTRY_BASE_DIR RUN unzip ${NIFI_REGISTRY_BASE_DIR}/nifi-registry-${NIFI_REGISTRY_VERSION}-bin.zip -d ${NIFI_REGISTRY_BASE_DIR} \ @@ -34,7 +38,7 @@ RUN unzip ${NIFI_REGISTRY_BASE_DIR}/nifi-registry-${NIFI_REGISTRY_VERSION}-bin.z && ln -s ${NIFI_REGISTRY_HOME} ${NIFI_REGISTRY_BASE_DIR}/nifi-registry-${NIFI_REGISTRY_VERSION} -FROM openjdk:8-jre +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi Registry " LABEL site="https://nifi.apache.org" @@ -51,8 +55,10 @@ RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: - && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ && chown -R nifi:nifi ${NIFI_REGISTRY_BASE_DIR} \ && apt-get update \ - && apt-get install -y jq xmlstarlet procps - + && apt-get install -y jq xmlstarlet procps \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* USER nifi diff --git a/nifi-registry/nifi-registry-docker-maven/dockermaven/integration-test.sh b/nifi-registry/nifi-registry-docker-maven/dockermaven/integration-test.sh index 54e26725ee..a8d8d66581 100755 --- a/nifi-registry/nifi-registry-docker-maven/dockermaven/integration-test.sh +++ b/nifi-registry/nifi-registry-docker-maven/dockermaven/integration-test.sh @@ -22,7 +22,10 @@ VERSION=$2 container_name=nifi-registry-${TAG}-integration-test -trap "{ docker ps -qaf Name=${container_name} | xargs docker rm -f; }" EXIT +trap "{ docker rm -f ${container_name}; }" EXIT + +echo "Deleting any existing ${container_name} containers" +docker rm -f ${container_name}; echo "Checking that all files are owned by NiFi" test -z $(docker run --rm --entrypoint /bin/bash apache/nifi-registry:${TAG} -c "find /opt/nifi-registry ! -user nifi") @@ -40,11 +43,15 @@ docker run -d --name ${container_name} apache/nifi-registry:${TAG} IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${container_name}) for i in $(seq 1 10) :; do - if docker exec ${container_name} bash -c "ss -ntl | grep 18080"; then + echo "Iteration: ${i}" + if docker exec ${container_name} bash -c " echo Running < /dev/tcp/${IP}/18080"; then break fi sleep 10 done +echo "Checking NiFi Registry REST API Access" +test "200" = "$(docker exec "${container_name}" bash -c "curl -s -o /dev/null -w %{http_code} -k http://${IP}:18080/nifi-registry-api/access")" + echo "Stopping NiFi Registry container" time docker stop ${container_name} diff --git a/nifi-registry/nifi-registry-docker-maven/dockermaven/pom.xml b/nifi-registry/nifi-registry-docker-maven/dockermaven/pom.xml index 590dab1810..a781966ec2 100644 --- a/nifi-registry/nifi-registry-docker-maven/dockermaven/pom.xml +++ b/nifi-registry/nifi-registry-docker-maven/dockermaven/pom.xml @@ -28,13 +28,8 @@ com.spotify dockerfile-maven-plugin - 1.3.5 - default - - build - 1000 diff --git a/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile b/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile index f1ffceaee6..92f71e9746 100644 --- a/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile +++ b/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile @@ -16,29 +16,34 @@ # under the License. # -FROM openjdk:8-jre-alpine +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi " +LABEL site="https://nifi.apache.org" ARG UID=1000 ARG GID=1000 -ARG NIFI_TOOLKIT_VERSION= -ARG NIFI_TOOLKIT_BINARY=nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz +ARG NIFI_TOOLKIT_VERSION=1.19.0 +ARG NIFI_TOOLKIT_BINARY=nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.zip ENV NIFI_TOOLKIT_BASE_DIR=/opt/nifi-toolkit -ENV NIFI_TOOLKIT_HOME=${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION} +ENV NIFI_TOOLKIT_HOME=${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-current -ADD ./sh/docker-entrypoint.sh /opt/sh/docker-entrypoint.sh +RUN mkdir -p ${NIFI_TOOLKIT_BASE_DIR} +COPY $NIFI_TOOLKIT_BINARY $NIFI_TOOLKIT_BASE_DIR +ADD sh/ ${NIFI_TOOLKIT_BASE_DIR}/scripts -# Fix docker-entrypoint perms as per https://issues.apache.org/jira/browse/MRESOURCES-236 and Setup NiFi user -RUN apk add --update curl bash jq openssl \ - && rm -rf /var/cache/apk/* \ - && chmod +x /opt/sh/docker-entrypoint.sh \ - && addgroup -g $GID nifi \ - && adduser -D -s /bin/ash -u $UID -G nifi nifi \ - && mkdir -p ${NIFI_TOOLKIT_BASE_DIR} - -ADD ${NIFI_TOOLKIT_BINARY} ${NIFI_TOOLKIT_BASE_DIR} -RUN chown -R nifi:nifi ${NIFI_TOOLKIT_BASE_DIR} +RUN chmod -R +x ${NIFI_TOOLKIT_BASE_DIR}/scripts/*.sh \ + && apt-get update \ + && apt-get install -y unzip jq openssl \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* \ + && groupadd -g ${GID} nifi \ + && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ + && unzip ${NIFI_TOOLKIT_BASE_DIR}/${NIFI_TOOLKIT_BINARY} -d ${NIFI_TOOLKIT_BASE_DIR} \ + && rm ${NIFI_TOOLKIT_BASE_DIR}/${NIFI_TOOLKIT_BINARY} \ + && ln -s ${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION} ${NIFI_TOOLKIT_HOME} \ + && chown -R nifi:nifi ${NIFI_TOOLKIT_BASE_DIR} USER nifi @@ -48,4 +53,4 @@ EXPOSE 9443 WORKDIR ${NIFI_TOOLKIT_HOME} # Startup NiFi -ENTRYPOINT ["/opt/sh/docker-entrypoint.sh"] +ENTRYPOINT ["../scripts/docker-entrypoint.sh"] diff --git a/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile.hub b/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile.hub index 32acb63407..7c1a3ccdb8 100644 --- a/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile.hub +++ b/nifi-toolkit/nifi-toolkit-assembly/docker/Dockerfile.hub @@ -16,13 +16,13 @@ # under the License. # -FROM openjdk:8-jre-alpine +FROM eclipse-temurin:11-jre LABEL maintainer="Apache NiFi " LABEL site="https://nifi.apache.org" ARG UID=1000 ARG GID=1000 -ARG NIFI_TOOLKIT_VERSION=1.17.0 +ARG NIFI_TOOLKIT_VERSION=1.19.0 ARG MIRROR=https://archive.apache.org/dist ENV NIFI_TOOLKIT_BASE_DIR /opt/nifi-toolkit @@ -31,14 +31,18 @@ ENV NIFI_TOOLKIT_BINARY nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.zip ENV NIFI_TOOLKIT_BINARY_PATH nifi/${NIFI_TOOLKIT_VERSION}/${NIFI_TOOLKIT_BINARY} ENV NIFI_TOOLKIT_BINARY_URL ${MIRROR}/${NIFI_TOOLKIT_BINARY_PATH} -ADD sh/docker-entrypoint.sh /opt/sh/docker-entrypoint.sh +ADD sh/ ${NIFI_TOOLKIT_BASE_DIR}/scripts # Setup NiFi user # Download, validate, and expand Apache NiFi Toolkit binary. -RUN apk add --update curl bash jq openssl \ - && rm -rf /var/cache/apk/* \ - && addgroup -g $GID nifi \ - && adduser -D -s /bin/ash -u $UID -G nifi nifi \ +RUN chmod -R +x ${NIFI_TOOLKIT_BASE_DIR}/scripts/*.sh \ + && apt-get update \ + && apt-get install -y unzip jq openssl \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* \ + && groupadd -g ${GID} nifi \ + && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ && mkdir -p ${NIFI_TOOLKIT_BASE_DIR} \ && curl -fSL ${NIFI_TOOLKIT_BINARY_URL} -o ${NIFI_TOOLKIT_BASE_DIR}/${NIFI_TOOLKIT_BINARY} \ && echo "$(curl ${NIFI_TOOLKIT_BINARY_URL}.sha256) *${NIFI_TOOLKIT_BASE_DIR}/${NIFI_TOOLKIT_BINARY}" | sha256sum -c - \ @@ -54,4 +58,4 @@ EXPOSE 9443 WORKDIR ${NIFI_TOOLKIT_HOME} # Startup NiFi -ENTRYPOINT ["/opt/sh/docker-entrypoint.sh"] +ENTRYPOINT ["../scripts/docker-entrypoint.sh"] diff --git a/nifi-toolkit/nifi-toolkit-assembly/docker/sh/docker-entrypoint.sh b/nifi-toolkit/nifi-toolkit-assembly/docker/sh/docker-entrypoint.sh index 05a0b31b84..3db34e43d6 100755 --- a/nifi-toolkit/nifi-toolkit-assembly/docker/sh/docker-entrypoint.sh +++ b/nifi-toolkit/nifi-toolkit-assembly/docker/sh/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -22,7 +22,7 @@ toolkit_path="${NIFI_TOOLKIT_HOME}/bin" program=$1 -function print_help() { +print_help () { if [ -z ${program} ]; then echo "No program option specified." else diff --git a/nifi-toolkit/nifi-toolkit-assembly/pom.xml b/nifi-toolkit/nifi-toolkit-assembly/pom.xml index 49d2e587ab..654dfe0a46 100644 --- a/nifi-toolkit/nifi-toolkit-assembly/pom.xml +++ b/nifi-toolkit/nifi-toolkit-assembly/pom.xml @@ -175,8 +175,8 @@ language governing permissions and limitations under the License. --> - - + + @@ -190,14 +190,8 @@ language governing permissions and limitations under the License. --> com.spotify dockerfile-maven-plugin - 1.3.5 - default - package - - build - ./target/docker-build diff --git a/pom.xml b/pom.xml index 6eb8b2a120..771b20a9a7 100644 --- a/pom.xml +++ b/pom.xml @@ -808,6 +808,19 @@ + + com.spotify + dockerfile-maven-plugin + 1.4.13 + + + default + + build + + + + org.codehaus.mojo rpm-maven-plugin