Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Dockerfile-ubuntu.template
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,16 @@ RUN groupadd --system --gid=9999 flink && \
WORKDIR $FLINK_HOME

# Install Flink
%%COPY_LOCAL_TGZ%%
RUN set -ex; \
wget -nv -O flink.tgz "$FLINK_TGZ_URL"; \
case "$FLINK_TGZ_URL" in \
http*) \
wget -nv -O flink.tgz "$FLINK_TGZ_URL"; \
;; \
*) \
# Use the locally copied TGZ file \
;; \
esac; \
\
if [ "$CHECK_GPG" = "true" ]; then \
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ in the same folder and version 1.11. Please substitute your folder structure and
5. Generate docker image (in `flink-docker/dev/flink-1.11-debian`): `docker build -t flink:1.11-SN .`
6. Run custom Flink docker image: `docker run -it flink:1.11-SN jobmanager`

### Build without running a containerized web server (skip step 3, above)

4. `./add-custom.sh -l -u flink-1.11.tgz -n flink-1.11`
The important changes from above in this step are to include the `-l` option (local TGZ file), and using a plain file as the argument for `-u`
4.a Copy the TGZ file into the Docker context dir (dev/flink-1.11) and make sure the copied filename in the context dir has the same name
as given in the `-u` argument.

Proceed with step 5, above.

16 changes: 13 additions & 3 deletions add-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@
source "$(dirname "$0")"/generator.sh

function usage() {
echo >&2 "usage: $0 -u binary-download-url [-n name] [-j java_version]"
echo >&2 "usage: $0 -u binary-download-url [-l] [-n name] [-j java_version]"
}

local_tgz=false
copy_local_tgz=
binary_download_url=
name=custom
java_version=${DEFAULT_JAVA}

while getopts u:n:j:h arg; do
while getopts u:n:j:lh arg; do
case "$arg" in
u)
binary_download_url=$OPTARG
;;
l)
local_tgz=true
;;
n)
name=$OPTARG
;;
Expand All @@ -41,13 +46,18 @@ if [ -z "${binary_download_url}" ]; then
exit 1
fi

if [ "${local_tgz}" = "true" ]; then
# Use local tgz file
copy_local_tgz="COPY $binary_download_url /opt/flink/flink.tgz"
binary_download_url=""
fi
mkdir -p "dev"

echo -n >&2 "Generating Dockerfiles..."
for source_variant in "${SOURCE_VARIANTS[@]}"; do
dir="dev/${name}-${source_variant}"
rm -rf "${dir}"
mkdir "$dir"
generateDockerfile "${dir}" "${binary_download_url}" "" "" false ${java_version} ${source_variant}
generateDockerfile "${dir}" "${binary_download_url}" "" "" false ${java_version} "${source_variant}" "${copy_local_tgz}"
done
echo >&2 " done."
2 changes: 2 additions & 0 deletions generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function generateDockerfile {
check_gpg=$5
java_version=$6
source_variant=$7
copy_local_tgz=$8

from_docker_image="eclipse-temurin:${java_version}-jre-jammy"

Expand All @@ -29,6 +30,7 @@ function generateDockerfile {
-e "s/%%GPG_KEY%%/$gpg_key/" \
-e "s/%%CHECK_GPG%%/${check_gpg}/" \
-e "s/%%FROM_IMAGE%%/${from_docker_image}/" \
-e "s!%%COPY_LOCAL_TGZ%%!${copy_local_tgz}!" \
"Dockerfile-$source_variant.template" > "$dir/Dockerfile"
}

Expand Down