blob: d10a82abaac596023e987081f264232460a44452 [file]
# 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 BASE_IMAGE="rockylinux:8"
FROM ${BASE_IMAGE} AS build
LABEL maintainer="Apache NiFi <dev@nifi.apache.org>"
ARG MINIFI_VERSION
ARG UID=1000
ARG GID=1000
# MINIFI_OPTIONS will be passed directly to cmake
# use it to define cmake options (e.g. -DENABLE_AWS=ON -DENABLE_AZURE=ON)
ARG MINIFI_OPTIONS=""
ARG CMAKE_BUILD_TYPE=Release
ARG DOCKER_SKIP_TESTS=ON
ARG DOCKER_MAKE_TARGET="all"
ARG DOCKER_CREATE_RPM=ON
ENV MINIFI_BASE_DIR=/opt/minifi
ENV MINIFI_HOME=$MINIFI_BASE_DIR/nifi-minifi-cpp-$MINIFI_VERSION
ENV USER=minificpp
RUN mkdir -p $MINIFI_BASE_DIR
COPY . ${MINIFI_BASE_DIR}
# Install the system dependencies needed for a build
# ccache is in EPEL
RUN dnf -y install epel-release && dnf -y install gcc-toolset-14 sudo git which make libarchive ccache ca-certificates perl patch bison flex libtool cmake rpmdevtools && \
if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_ALL=ON\|ENABLE_PYTHON_SCRIPTING=ON\|ENABLE_OPC=ON"; then dnf -y --enablerepo=devel install python3-devel; fi && \
if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_SFTP=ON" && [ "${DOCKER_SKIP_TESTS}" == "OFF" ]; then dnf -y install java-1.8.0-openjdk maven; fi
RUN cd $MINIFI_BASE_DIR && \
ln -s /usr/bin/ccache /usr/lib64/ccache/c++
# Setup minificpp user
RUN groupadd -g ${GID} ${USER} && useradd -g ${GID} ${USER} && \
chown -R ${USER}:${USER} ${MINIFI_BASE_DIR}
USER ${USER}
# Perform the build
RUN cd $MINIFI_BASE_DIR && \
mkdir build && \
cd build && \
source /opt/rh/gcc-toolset-14/enable && \
export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \
export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \
cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \
make -j "$(nproc)" ${DOCKER_MAKE_TARGET}
# Perform RPM build
RUN if [[ "${DOCKER_CREATE_RPM}" == "ON" ]] ; then \
cd $MINIFI_BASE_DIR && \
cd build && \
source /opt/rh/gcc-toolset-14/enable && \
cmake -DMINIFI_PACKAGING_TYPE=RPM .. && \
make -j "$(nproc)" package&& \
../packaging/rpm/check_rpm_contents.sh *.rpm expected-rpm-contents.txt; \
fi