52 lines
1.7 KiB
Bash
52 lines
1.7 KiB
Bash
|
#!/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:jdk-${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}" ] || {
|
||
|
curl -LR -o "artifact-cache/${GRAALVM_BASE_FILE}" "${GRAALVM_URI}"
|
||
|
}
|
||
|
|
||
|
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.jdk \
|
||
|
-t "${img_fq}" \
|
||
|
--pull=missing --no-cache \
|
||
|
--build-arg "IMAGE_VERSION=${IMAGE_VERSION}" \
|
||
|
--build-arg "JAVA_VERSION_MAJOR=${JAVA_VERSION_MAJOR}" \
|
||
|
--build-arg "GRAALVM_BASE_FILE=${GRAALVM_BASE_FILE}" \
|
||
|
--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}"
|