2016-12-29 15:36:04 -05:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
|
2017-06-11 15:22:51 -04:00
|
|
|
FROM openjdk:8-jre
|
2017-11-28 20:00:32 -05:00
|
|
|
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
|
|
|
|
LABEL site="https://nifi.apache.org"
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2017-01-13 16:56:49 -05:00
|
|
|
ARG UID=1000
|
2017-06-11 15:22:51 -04:00
|
|
|
ARG GID=1000
|
2018-06-25 15:06:57 -04:00
|
|
|
ARG NIFI_VERSION=1.8.0
|
2018-07-27 08:53:39 -04:00
|
|
|
ARG BASE_URL=https://archive.apache.org/dist
|
|
|
|
ARG MIRROR_BASE_URL=${MIRROR_BASE_URL:-${BASE_URL}}
|
|
|
|
ARG NIFI_BINARY_PATH=${NIFI_BINARY_PATH:-/nifi/${NIFI_VERSION}/nifi-${NIFI_VERSION}-bin.zip}
|
|
|
|
ARG NIFI_TOOLKIT_BINARY_PATH=${NIFI_TOOLKIT_BINARY_PATH:-/nifi/${NIFI_VERSION}/nifi-toolkit-${NIFI_VERSION}-bin.zip}
|
|
|
|
|
|
|
|
ENV NIFI_BASE_DIR=/opt/nifi
|
|
|
|
ENV NIFI_HOME=${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2018-05-29 07:27:45 -04:00
|
|
|
ENV NIFI_PID_DIR=${NIFI_HOME}/run
|
|
|
|
ENV NIFI_LOG_DIR=${NIFI_HOME}/logs
|
2017-11-28 20:00:32 -05:00
|
|
|
|
2018-05-29 07:27:45 -04:00
|
|
|
ADD sh/ ${NIFI_BASE_DIR}/scripts/
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2018-05-29 07:27:45 -04:00
|
|
|
# Setup NiFi user and create necessary directories
|
2017-11-28 20:00:32 -05:00
|
|
|
RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \
|
|
|
|
&& useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \
|
2018-07-18 04:46:09 -04:00
|
|
|
&& mkdir -p ${NIFI_HOME}/conf \
|
|
|
|
&& mkdir -p ${NIFI_HOME}/database_repository \
|
|
|
|
&& mkdir -p ${NIFI_HOME}/flowfile_repository \
|
|
|
|
&& mkdir -p ${NIFI_HOME}/content_repository \
|
|
|
|
&& mkdir -p ${NIFI_HOME}/provenance_repository \
|
|
|
|
&& mkdir -p ${NIFI_HOME}/state \
|
|
|
|
&& mkdir -p ${NIFI_LOG_DIR} \
|
2017-11-28 20:00:32 -05:00
|
|
|
&& chown -R nifi:nifi ${NIFI_BASE_DIR} \
|
|
|
|
&& apt-get update \
|
2018-05-29 07:27:45 -04:00
|
|
|
&& apt-get install -y jq xmlstarlet procps
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2017-06-11 15:22:51 -04:00
|
|
|
USER nifi
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2018-07-27 08:53:39 -04:00
|
|
|
# Download, validate, and expand Apache NiFi Toolkit binary.
|
|
|
|
RUN curl -fSL ${MIRROR_BASE_URL}/${NIFI_TOOLKIT_BINARY_PATH} -o ${NIFI_BASE_DIR}/nifi-toolkit-${NIFI_VERSION}-bin.zip \
|
|
|
|
&& echo "$(curl ${BASE_URL}/${NIFI_TOOLKIT_BINARY_PATH}.sha256) *${NIFI_BASE_DIR}/nifi-toolkit-${NIFI_VERSION}-bin.zip" | sha256sum -c - \
|
|
|
|
&& unzip ${NIFI_BASE_DIR}/nifi-toolkit-${NIFI_VERSION}-bin.zip -d ${NIFI_BASE_DIR} \
|
|
|
|
&& rm ${NIFI_BASE_DIR}/nifi-toolkit-${NIFI_VERSION}-bin.zip
|
|
|
|
|
2017-06-11 15:22:51 -04:00
|
|
|
# Download, validate, and expand Apache NiFi binary.
|
2018-07-27 08:53:39 -04:00
|
|
|
RUN curl -fSL ${MIRROR_BASE_URL}/${NIFI_BINARY_PATH} -o ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.zip \
|
|
|
|
&& echo "$(curl ${BASE_URL}/${NIFI_BINARY_PATH}.sha256) *${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.zip" | sha256sum -c - \
|
|
|
|
&& unzip ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.zip -d ${NIFI_BASE_DIR} \
|
|
|
|
&& rm ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.zip
|
2018-05-29 07:27:45 -04:00
|
|
|
|
2018-07-18 04:46:09 -04:00
|
|
|
VOLUME ${NIFI_LOG_DIR} \
|
|
|
|
${NIFI_HOME}/conf \
|
|
|
|
${NIFI_HOME}/database_repository \
|
|
|
|
${NIFI_HOME}/flowfile_repository \
|
|
|
|
${NIFI_HOME}/content_repository \
|
|
|
|
${NIFI_HOME}/provenance_repository \
|
|
|
|
${NIFI_HOME}/state
|
|
|
|
|
2018-05-29 07:27:45 -04:00
|
|
|
# Clear nifi-env.sh in favour of configuring all environment variables in the Dockerfile
|
|
|
|
RUN echo "#!/bin/sh\n" > $NIFI_HOME/bin/nifi-env.sh
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2017-11-28 20:00:32 -05:00
|
|
|
# Web HTTP(s) & Socket Site-to-Site Ports
|
|
|
|
EXPOSE 8080 8443 10000
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2017-11-28 20:00:32 -05:00
|
|
|
WORKDIR ${NIFI_HOME}
|
2016-12-29 15:36:04 -05:00
|
|
|
|
2017-11-28 20:00:32 -05:00
|
|
|
# Apply configuration and start NiFi
|
2018-05-29 07:27:45 -04:00
|
|
|
#
|
|
|
|
# We need to use the exec form to avoid running our command in a subshell and omitting signals,
|
|
|
|
# thus being unable to shut down gracefully:
|
|
|
|
# https://docs.docker.com/engine/reference/builder/#entrypoint
|
|
|
|
#
|
|
|
|
# Also we need to use relative path, because the exec form does not invoke a command shell,
|
|
|
|
# thus normal shell processing does not happen:
|
|
|
|
# https://docs.docker.com/engine/reference/builder/#exec-form-entrypoint-example
|
|
|
|
ENTRYPOINT ["../scripts/start.sh"]
|