52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -ef
|
|
cd "$(dirname "$0")/.."
|
|
|
|
IMAGE_VERSION="${IMAGE_VERSION:-bookworm-v0.0.1}"
|
|
JAVA_VERSION_MAJOR="${JAVA_VERSION_MAJOR:-17}"
|
|
|
|
set -a
|
|
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"
|
|
BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}"
|
|
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
|
|
set +a
|
|
|
|
img="docker.io/rockdrilla/graalvm-debian:jre-${JAVA_VERSION_MAJOR}"
|
|
img_fq="${img}-${IMAGE_VERSION}"
|
|
|
|
GRAALVM_BASE_URI="https://download.oracle.com/graalvm/${JAVA_VERSION_MAJOR}/latest"
|
|
GRAALVM_BASE_FILE="graalvm-jdk-${JAVA_VERSION_MAJOR}_linux-x64_bin.tar.gz"
|
|
GRAALVM_URI="${GRAALVM_BASE_URI}/${GRAALVM_BASE_FILE}"
|
|
|
|
mkdir -p artifact-cache
|
|
[ -s "artifact-cache/${GRAALVM_BASE_FILE}" ] || {
|
|
echo 'build JDK first' >&2
|
|
exit 1
|
|
}
|
|
|
|
w=$(mktemp -d) ; : "${w:?}"
|
|
|
|
tar -C "$w" --strip-components=1 -xf "artifact-cache/${GRAALVM_BASE_FILE}"
|
|
grep -E '^(GRAALVM_VERSION|JAVA_VERSION|JAVA_RUNTIME_VERSION|JAVA_VERSION_DATE)=' < "$w/release" > "$w/relenv"
|
|
|
|
GRAALVM_VERSION=$( . "$w/relenv" ; echo "${GRAALVM_VERSION:?}")
|
|
JAVA_VERSION=$( . "$w/relenv" ; echo "${JAVA_VERSION:?}")
|
|
JAVA_RUNTIME_VERSION=$( . "$w/relenv" ; echo "${JAVA_RUNTIME_VERSION:?}")
|
|
JAVA_VERSION_DATE=$( . "$w/relenv" ; echo "${JAVA_VERSION_DATE:?}")
|
|
|
|
rm -rf "$w" ; unset w
|
|
|
|
buildah bud \
|
|
-f ./Dockerfile.jre \
|
|
-t "${img_fq}" \
|
|
--pull=missing --no-cache \
|
|
--build-arg "IMAGE_VERSION=${IMAGE_VERSION}" \
|
|
--build-arg "JAVA_VERSION_MAJOR=${JAVA_VERSION_MAJOR}" \
|
|
--env "GRAALVM_VERSION=${GRAALVM_VERSION}" \
|
|
--env "JAVA_VERSION=${JAVA_VERSION}" \
|
|
--env "JAVA_RUNTIME_VERSION=${JAVA_RUNTIME_VERSION}" \
|
|
--env "JAVA_VERSION_DATE=${JAVA_VERSION_DATE}" \
|
|
|
|
|
|
podman tag "${img_fq}" "${img}"
|