forked from apache/nifi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Providing Docker support of the NiFi Toolkit via Maven build and Docker Hub.
- Loading branch information
Showing
4 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 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. | ||
# | ||
|
||
FROM openjdk:8-jre-alpine | ||
LABEL maintainer="Apache NiFi <[email protected]>" | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
ARG NIFI_TOOLKIT_VERSION=${project.version} | ||
ARG NIFI_TOOLKIT_BINARY=nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz | ||
|
||
ENV NIFI_TOOLKIT_BASE_DIR=/opt/nifi-toolkit | ||
ENV NIFI_TOOLKIT_HOME=${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION} | ||
|
||
ADD ./sh/docker-entrypoint.sh /opt/sh/docker-entrypoint.sh | ||
|
||
# Fix docker-entrypoint perms as per https://issues.apache.org/jira/browse/MRESOURCES-236 and Setup NiFi user | ||
RUN chmod +x /opt/sh/docker-entrypoint.sh \ | ||
&& addgroup -g $GID nifi \ | ||
&& adduser -D -s /bin/ash -u $UID -G nifi nifi \ | ||
&& mkdir -p ${NIFI_TOOLKIT_BASE_DIR} | ||
|
||
ADD ${NIFI_TOOLKIT_BINARY} ${NIFI_TOOLKIT_BASE_DIR} | ||
RUN chown -R nifi:nifi ${NIFI_TOOLKIT_BASE_DIR} | ||
|
||
USER nifi | ||
|
||
# Default port for TLS Toolkit CA Server | ||
EXPOSE 8443 | ||
|
||
WORKDIR ${NIFI_TOOLKIT_HOME} | ||
|
||
# Startup NiFi | ||
ENTRYPOINT ["/opt/sh/docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 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. | ||
# | ||
|
||
FROM openjdk:8-jre-alpine | ||
LABEL maintainer "Apache NiFi <[email protected]>" | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
ARG NIFI_TOOLKIT_VERSION=1.5.0 | ||
ARG MIRROR=https://archive.apache.org/dist | ||
|
||
ENV NIFI_TOOLKIT_BASE_DIR=/opt/nifi-toolkit | ||
ENV NIFI_TOOLKIT_HOME=${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION} \ | ||
NIFI_TOOLKIT_BINARY_URL=${MIRROR}/nifi/${NIFI_TOOLKIT_VERSION}/nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz | ||
|
||
ADD sh/docker-entrypoint.sh /opt/sh/docker-entrypoint.sh | ||
|
||
# Setup NiFi user | ||
# Download, validate, and expand Apache NiFi Toolkit binary. | ||
RUN apk add --update curl \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& addgroup -g $GID nifi \ | ||
&& adduser -D -s /bin/ash -u $UID -G nifi nifi \ | ||
&& mkdir -p ${NIFI_TOOLKIT_BASE_DIR} \ | ||
&& curl -fSL ${NIFI_TOOLKIT_BINARY_URL} -o ${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz \ | ||
&& echo "$(curl ${NIFI_TOOLKIT_BINARY_URL}.sha256) *${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz" | sha256sum -c - \ | ||
&& tar -xvzf ${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz -C ${NIFI_TOOLKIT_BASE_DIR} \ | ||
&& rm ${NIFI_TOOLKIT_BASE_DIR}/nifi-toolkit-${NIFI_TOOLKIT_VERSION}-bin.tar.gz \ | ||
&& chown -R nifi:nifi ${NIFI_TOOLKIT_BASE_DIR} | ||
|
||
USER nifi | ||
|
||
# Default port for TLS Toolkit CA Server | ||
EXPOSE 8443 | ||
|
||
WORKDIR ${NIFI_TOOLKIT_HOME} | ||
|
||
# Startup NiFi | ||
ENTRYPOINT ["/opt/sh/docker-entrypoint.sh"] |
40 changes: 40 additions & 0 deletions
40
nifi-toolkit/nifi-toolkit-assembly/docker/sh/docker-entrypoint.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh -e | ||
|
||
# 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. | ||
# | ||
|
||
toolkit_path="${NIFI_TOOLKIT_HOME}/bin" | ||
|
||
program=$1 | ||
|
||
function print_help() { | ||
if [ -z ${program} ]; then | ||
echo "No program option specified." | ||
else | ||
echo "Could not find program \"${program}\" to execute." | ||
fi | ||
echo 'Options available include: ' $(for script in $(find "${toolkit_path}" -type f -name '*.sh'); do basename ${script} '.sh'; done) | ||
} | ||
|
||
# Find out which component of the Toolkit we are using | ||
if ! [ -f "${toolkit_path}/${program}.sh" ]; then | ||
print_help ${program} | ||
else | ||
shift | ||
${toolkit_path}/${program}.sh $@ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters