1 # ============LICENSE_START=====================================================
2 # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
3 # ==============================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # ============LICENSE_END=======================================================
17 FROM apache/nifi:${nifi.version} as original
19 FROM openjdk:8 as artifactbase
21 ENV NIFI_BASE_DIR /opt/nifi
23 COPY --from=original $NIFI_BASE_DIR $NIFI_BASE_DIR
27 COPY target/designtool-web-${project.version}.war /tmp/patches
29 RUN bash /tmp/patches/applypatches.sh ${project.version} ${nifi.version}
36 ENV NIFI_BASE_DIR /opt/nifi
37 ENV NIFI_HOME ${NIFI_BASE_DIR}/nifi-current
38 ENV NIFI_TOOLKIT_HOME ${NIFI_BASE_DIR}/nifi-toolkit-current
39 ENV NIFI_PID_DIR=${NIFI_HOME}/run
40 ENV NIFI_LOG_DIR=${NIFI_HOME}/logs
42 # Setup NiFi user and create necessary directories
43 RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \
44 && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \
46 && apt-get install -y jq xmlstarlet procps
48 COPY --chown=nifi:nifi --from=artifactbase $NIFI_BASE_DIR $NIFI_BASE_DIR
50 VOLUME ${NIFI_LOG_DIR} \
52 ${NIFI_HOME}/database_repository \
53 ${NIFI_HOME}/flowfile_repository \
54 ${NIFI_HOME}/content_repository \
55 ${NIFI_HOME}/provenance_repository \
60 # Clear nifi-env.sh in favour of configuring all environment variables in the Dockerfile
61 RUN echo "#!/bin/sh\n" > $NIFI_HOME/bin/nifi-env.sh
63 # Web HTTP(s) & Socket Site-to-Site Ports
64 EXPOSE 8080 8443 10000
68 # Apply configuration and start NiFi
70 # We need to use the exec form to avoid running our command in a subshell and omitting signals,
71 # thus being unable to shut down gracefully:
72 # https://docs.docker.com/engine/reference/builder/#entrypoint
74 # Also we need to use relative path, because the exec form does not invoke a command shell,
75 # thus normal shell processing does not happen:
76 # https://docs.docker.com/engine/reference/builder/#exec-form-entrypoint-example
77 ENTRYPOINT ["../scripts/start.sh"]