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 <chris.sampson82@gmail.com>
Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Kevin Doran 2022-11-16 23:03:15 -05:00 committed by Chris Sampson
parent 214bd2f00c
commit 78f206a811
22 changed files with 262 additions and 193 deletions

View File

@ -16,7 +16,7 @@
# under the License.
#
FROM eclipse-temurin:8-jre
FROM eclipse-temurin:11-jre
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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"]

View File

@ -16,7 +16,7 @@
# under the License.
#
FROM eclipse-temurin:8-jre
FROM eclipse-temurin:11-jre
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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"]

View File

@ -40,37 +40,45 @@ limitations under the License.
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<id>copy-assembly-for-docker</id>
<goals>
<goal>build</goal>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<target name="copy assembly for docker image build">
<copy todir="${project.basedir}/target" overwrite="true" flatten="true">
<fileset dir="${project.basedir}/../minifi-c2-assembly/target" includes="*.zip">
<include name="*.zip" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<dockerfile>dockermaven/Dockerfile</dockerfile>
<buildArgs>
<UID>1000</UID>
<GID>1000</GID>
<MINIFI_C2_VERSION>${minifi.c2.version}</MINIFI_C2_VERSION>
<MINIFI_C2_BINARY>target/minifi-c2-${minifi.c2.version}-bin.zip</MINIFI_C2_BINARY>
</buildArgs>
<repository>apacheminific2</repository>
<tag>${minifi.c2.version}</tag>
</configuration>
</execution>
</executions>
<configuration>
<imageName>apacheminific2</imageName>
<dockerDirectory>${project.basedir}/dockermaven</dockerDirectory>
<imageTags>
<imageTag>${minifi.c2.version}</imageTag>
</imageTags>
<buildArgs>
<UID>1000</UID>
<GID>1000</GID>
<MINIFI_C2_VERSION>${minifi.c2.version}</MINIFI_C2_VERSION>
<MINIFI_C2_BINARY>minifi-c2-${minifi.c2.version}-bin.tar.gz</MINIFI_C2_BINARY>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.basedir}/../minifi-c2-assembly/target</directory>
<include>minifi-c2-${minifi.c2.version}-bin.tar.gz</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -16,7 +16,7 @@
# under the License.
#
FROM eclipse-temurin:8-jre
FROM eclipse-temurin:11-jre
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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"]

View File

@ -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 <dev@nifi.apache.org>"
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"]

View File

@ -31,7 +31,7 @@ limitations under the License.
<properties>
<minifi.version>${project.version}</minifi.version>
<docker.image.name>eclipse-temurin</docker.image.name>
<docker.image.tag>8-jre</docker.image.tag>
<docker.image.tag>11-jre</docker.image.tag>
</properties>
<profiles>
@ -41,39 +41,64 @@ limitations under the License.
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<id>copy-scripts-for-docker</id>
<phase>process-sources</phase>
<configuration>
<target name="copy docker scripts for image build">
<copy todir="${project.basedir}/target/sh" overwrite="true" flatten="true">
<fileset dir="${project.basedir}/dockerhub/sh" includes="*.sh">
<include name="*.sh" />
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>build</goal>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>copy-assembly-for-docker</id>
<phase>process-sources</phase>
<configuration>
<target name="copy assembly for image build">
<copy todir="${project.basedir}/target" overwrite="true" flatten="true">
<fileset dir="${project.basedir}/../minifi-assembly/target" includes="*.zip">
<include name="*.zip" />
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>apacheminifi</imageName>
<dockerDirectory>${project.basedir}/dockermaven</dockerDirectory>
<imageTags>
<imageTag>${minifi.version}</imageTag>
</imageTags>
<buildArgs>
<IMAGE_NAME>${docker.image.name}</IMAGE_NAME>
<IMAGE_TAG>${docker.image.tag}</IMAGE_TAG>
<UID>1000</UID>
<GID>1000</GID>
<MINIFI_VERSION>${minifi.version}</MINIFI_VERSION>
<MINIFI_BINARY>minifi-${minifi.version}-bin.tar.gz</MINIFI_BINARY>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.basedir}/../minifi-assembly/target</directory>
<include>minifi-${minifi.version}-bin.tar.gz</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<dockerfile>dockermaven/Dockerfile</dockerfile>
<buildArgs>
<IMAGE_NAME>${docker.image.name}</IMAGE_NAME>
<IMAGE_TAG>${docker.image.tag}</IMAGE_TAG>
<UID>1000</UID>
<GID>1000</GID>
<MINIFI_VERSION>${minifi.version}</MINIFI_VERSION>
<MINIFI_BINARY>target/minifi-${minifi.version}-bin.zip</MINIFI_BINARY>
<MINIFI_SCRIPTS>target/sh</MINIFI_SCRIPTS>
</buildArgs>
<repository>apacheminifi</repository>
<tag>${minifi.version}</tag>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -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 <dev@nifi.apache.org>"
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

View File

@ -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

View File

@ -21,12 +21,9 @@
<artifactId>dockerhub</artifactId>
<properties>
<docker.image.name>openjdk</docker.image.name>
<docker.image.tag>8-jre</docker.image.tag>
<docker.maintainer><![CDATA[Apache NiFi <dev@nifi.apache.org>]]></docker.maintainer>
<!-- files need to exist at https://archive.apache.org/dist/nifi/${docker.nifi.version}/nifi-[toolkit-]${docker.nifi.version}-bin.zip
so this version needs to be *before* the current ${project.version} -->
<docker.nifi.version>1.14.0</docker.nifi.version>
<docker.nifi.version>1.19.0</docker.nifi.version>
</properties>
<profiles>

View File

@ -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 <dev@nifi.apache.org>"
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

View File

@ -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")"

View File

@ -20,12 +20,6 @@
<artifactId>dockermaven</artifactId>
<properties>
<docker.image.name>openjdk</docker.image.name>
<docker.image.tag>8-jre</docker.image.tag>
<docker.maintainer><![CDATA[Apache NiFi <dev@nifi.apache.org>]]></docker.maintainer>
</properties>
<profiles>
<profile>
<id>docker</id>
@ -71,7 +65,7 @@
<version>3.0.0</version>
<executions>
<execution>
<id>copy-sh-for-docker</id>
<id>copy-scripts-for-docker</id>
<phase>process-sources</phase>
<configuration>
<target name="copy docker scripts to nifi-docker for image build">
@ -87,7 +81,7 @@
</goals>
</execution>
<execution>
<id>copy-for-docker</id>
<id>copy-nifi-assembly-for-docker</id>
<phase>process-sources</phase>
<configuration>
<target name="copy assembly to nifi-docker for image build">
@ -103,7 +97,7 @@
</goals>
</execution>
<execution>
<id>copy-toolkit-for-docker</id>
<id>copy-nifi-toolkit-assembly-for-docker</id>
<phase>process-sources</phase>
<configuration>
<target name="copy toolkit assembly to nifi-docker for image build">

View File

@ -23,6 +23,9 @@ language governing permissions and limitations under the License. -->
<properties>
<nifi.version>${project.version}</nifi.version>
<docker.image.name>eclipse-temurin</docker.image.name>
<docker.image.tag>11-jre</docker.image.tag>
<docker.maintainer><![CDATA[Apache NiFi <dev@nifi.apache.org>]]></docker.maintainer>
</properties>
<modules>
@ -30,28 +33,4 @@ language governing permissions and limitations under the License. -->
<module>dockerhub</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<tag>${nifi.version}</tag>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -16,13 +16,13 @@
# under the License.
#
FROM openjdk:8-jdk-slim
FROM eclipse-temurin:11-jre
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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"]

View File

@ -16,16 +16,20 @@
# under the License.
#
FROM openjdk:8-jre AS artifactbase
FROM eclipse-temurin:11-jre AS artifactbase
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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 <dev@nifi.apache.org>"
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

View File

@ -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}

View File

@ -28,13 +28,8 @@
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.5</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<buildArgs>
<UID>1000</UID>

View File

@ -16,29 +16,34 @@
# under the License.
#
FROM openjdk:8-jre-alpine
FROM eclipse-temurin:11-jre
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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"]

View File

@ -16,13 +16,13 @@
# under the License.
#
FROM openjdk:8-jre-alpine
FROM eclipse-temurin:11-jre
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
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"]

View File

@ -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

View File

@ -175,8 +175,8 @@ language governing permissions and limitations under the License. -->
<configuration>
<target name="copy assembly to docker for image build">
<copy todir="${project.basedir}/target/docker-build" overwrite="true" flatten="true">
<fileset dir="${project.basedir}/target" includes="*.tar.gz">
<include name="*.tar.gz" />
<fileset dir="${project.basedir}/target" includes="*.zip">
<include name="*.zip" />
</fileset>
</copy>
</target>
@ -190,14 +190,8 @@ language governing permissions and limitations under the License. -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.5</version>
<executions>
<execution>
<id>default</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<contextDirectory>./target/docker-build</contextDirectory>
<buildArgs>

13
pom.xml
View File

@ -808,6 +808,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>