guimou commented on a change in pull request #5684: URL: https://github.com/apache/nifi/pull/5684#discussion_r819034629
########## File path: nifi-docker/openshift/Dockerfile ########## @@ -0,0 +1,109 @@ +# 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. +# +ARG IMAGE_NAME=registry.access.redhat.com/ubi8/openjdk-11 +ARG IMAGE_TAG=1.10 +FROM ${IMAGE_NAME}:${IMAGE_TAG} +ARG MAINTAINER="Apache NiFi <d...@nifi.apache.org>" +LABEL maintainer="${MAINTAINER}" +LABEL site="https://nifi.apache.org" + +ARG UID=1001 +ARG GID=0 +ARG NIFI_VERSION=1.16.0 +ARG BASE_URL=https://archive.apache.org/dist +ARG MIRROR_BASE_URL=${MIRROR_BASE_URL:-${BASE_URL}} +ARG DISTRO_PATH=${DISTRO_PATH:-${NIFI_VERSION}} +ARG NIFI_BINARY_PATH=${NIFI_BINARY_PATH:-/nifi/${DISTRO_PATH}/nifi-${NIFI_VERSION}-bin.zip} +ARG NIFI_TOOLKIT_BINARY_PATH=${NIFI_TOOLKIT_BINARY_PATH:-/nifi/${DISTRO_PATH}/nifi-toolkit-${NIFI_VERSION}-bin.zip} + +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 + +#Bugfix https://issues.redhat.com/browse/OPENJDK-335 +ENV NSS_WRAPPER_PASSWD= +ENV NSS_WRAPPER_GROUP= + +ADD sh/ ${NIFI_BASE_DIR}/scripts/ + +USER root + +RUN chmod -R +x ${NIFI_BASE_DIR}/scripts/*.sh + +# Setup NiFi user and create necessary directories +RUN useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ + && mkdir -p ${NIFI_BASE_DIR} \ + && chown -R ${UID}:${GID} ${NIFI_BASE_DIR} \ + && rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \ + && microdnf update \ + && microdnf install -y jq xmlstarlet procps-ng hostname nano openssl gzip + +USER 1001 + +# 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 \ + && mv ${NIFI_BASE_DIR}/nifi-toolkit-${NIFI_VERSION} ${NIFI_TOOLKIT_HOME} \ + && ln -s ${NIFI_TOOLKIT_HOME} ${NIFI_BASE_DIR}/nifi-toolkit-${NIFI_VERSION} + +# Download, validate, and expand Apache NiFi binary. +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 \ + && mv ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION} ${NIFI_HOME} \ + && 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} \ + && ln -s ${NIFI_HOME} ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION} \ + && chown -R ${UID}:${GID} ${NIFI_BASE_DIR} + +# 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 8000 + +WORKDIR ${NIFI_HOME} + +#OpenShift specific fixes +RUN ${NIFI_BASE_DIR}/scripts/fix-permissions.sh ${NIFI_BASE_DIR} + +ENV HOME=${NIFI_HOME} + +USER 1001 Review comment: Good catch, this is already under USER 1001. I will remove it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org