# ============LICENSE_START===================================================== # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. # ============================================================================== # Licensed 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. # ============LICENSE_END======================================================= FROM apache/nifi:${nifi.version} as original FROM openjdk:8 as artifactbase ENV NIFI_BASE_DIR /opt/nifi COPY --from=original $NIFI_BASE_DIR $NIFI_BASE_DIR ADD sh/ /tmp/patches COPY target/designtool-web-${project.version}.war /tmp/patches RUN bash /tmp/patches/applypatches.sh ${project.version} ${nifi.version} FROM openjdk:8-jre ARG UID=1000 ARG GID=1000 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 # Setup NiFi user and create necessary directories 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 COPY --chown=nifi:nifi --from=artifactbase $NIFI_BASE_DIR $NIFI_BASE_DIR 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 USER nifi # 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 # Web HTTP(s) & Socket Site-to-Site Ports EXPOSE 8080 8443 10000 WORKDIR ${NIFI_HOME} # Apply configuration and start NiFi # # 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"]