adjusted docker/makeImageForLatestRelease so it fetches release from Github

This commit is contained in:
Axel Uhl committed 2024-05-23 16:10:12 +02:00
1 parent bcca62a6cb
commit b76aed1639
2 files changed
+30 -18

No files matched your search

+4
View File
@@ -1,4 +1,8 @@
FROM eclipse-temurin:8-jdk
# This Dockerfile assumes that the release to use is provided as
# ${RELEASE}.tar.gz in the current Docker workspace. Use, e.g.,
# the configuration/github-download-release-assets.sh script to
# obtain the tar.gz file for a specific or the latest "main" release.
# To build with an SAP JVM 8 base image built using Dockerfile_sapjvm, use something like:
#FROM sapjvm8:8.1.098
ARG RELEASE
+26 -18
View File
@@ -1,23 +1,31 @@
#!/bin/bash
release=$1
if [ "${release}" = "" ]; then
SET_LATEST=1
release=$(wget -O - https://releases.sapsailing.com/ 2>/dev/null | grep 'build-[0-9]\{10\}' | tail -1 | sed -e 's/^.*\(build-[0-9]*\).*$/\1/')
echo Latest release is ${release}
fi
release_prefix=$1
GITROOT="`dirname $0`/.."
DOCKERDIR="${GITROOT}/docker"
DOCKERFILE="$DOCKERDIR/Dockerfile"
echo "Copying files from GITROOT $GITROOT into Docker workspace"
cp "$GITROOT/java/target/env.sh" "$DOCKERDIR"
cp "$GITROOT/java/target/start" "$DOCKERDIR"
cp "$GITROOT/java/target/configuration/JavaSE-11.profile" "$DOCKERDIR"
cd "$DOCKERDIR"
docker build --build-arg RELEASE=${release} -t ghcr.io/sap/sailing-analytics:${release} .
echo "Cleaning up..."
rm start env.sh JavaSE-11.profile
docker push ghcr.io/sap/sailing-analytics:${release}
if [ "$SET_LATEST" = "1" ]; then
docker tag ghcr.io/sap/sailing-analytics:${release} ghcr.io/sap/sailing-analytics:latest
docker push ghcr.io/sap/sailing-analytics:latest
if [ "${release_prefix}" = "" ]; then
SET_LATEST=1
release_prefix="main-"
fi
pushd "${DOCKERDIR}"
RELEASE_TAR_GZ_FILENAME=$( ${GITROOT}/configuration/github-download-release-assets.sh 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 "${release_prefix}" )
if [ "${RELEASE_TAR_GZ_FILENAME}" = "" ]; then
echo "No release with prefix ${release_prefix} found" >&2
else
release=$( echo ${RELEASE_TAR_GZ_FILENAME} | sed -e 's/\.tar\.gz//' )
echo Release is ${release}
echo "Copying files from GITROOT $GITROOT into Docker workspace"
cp "$GITROOT/java/target/env.sh" "$DOCKERDIR"
cp "$GITROOT/java/target/start" "$DOCKERDIR"
cp "$GITROOT/java/target/configuration/JavaSE-11.profile" "$DOCKERDIR"
cd "$DOCKERDIR"
docker build --build-arg RELEASE=${release} -t ghcr.io/sap/sailing-analytics:${release} .
echo "Cleaning up..."
rm start env.sh JavaSE-11.profile ${RELEASE_TAR_GZ_FILENAME} release-notes.txt
docker push ghcr.io/sap/sailing-analytics:${release}
if [ "$SET_LATEST" = "1" ]; then
docker tag ghcr.io/sap/sailing-analytics:${release} ghcr.io/sap/sailing-analytics:latest
docker push ghcr.io/sap/sailing-analytics:latest
fi
fi
popd