Skip to content

Commit 4dcd1b6

Browse files
committed
Use ubi10 as builder image and switch base to micro
1 parent 3b820be commit 4dcd1b6

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

docker/Dockerfile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,47 @@
1313

1414
# syntax=docker/dockerfile:1
1515
ARG TRINO_GATEWAY_BASE_IMAGE
16-
FROM ${TRINO_GATEWAY_BASE_IMAGE} AS jdk-download
16+
ARG TRINO_GATEWAY_BUILD_IMAGE
17+
18+
FROM ${TRINO_GATEWAY_BUILD_IMAGE} AS jdk-download
1719
ARG JDK_DOWNLOAD_LINK
1820
ARG JDK_RELEASE_NAME
1921
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_RELEASE_NAME}"
2022

2123
RUN \
2224
set -xeuo pipefail && \
23-
microdnf install -y tar gzip && \
25+
dnf install -y tar gzip && \
2426
# Install JDK from the provided archive link \
2527
echo "Downloading JDK from ${JDK_DOWNLOAD_LINK}" && \
2628
mkdir -p "${JAVA_HOME}" && \
2729
curl -#LfS "${JDK_DOWNLOAD_LINK}" | tar -zx --strip 1 -C "${JAVA_HOME}"
2830

31+
FROM ${TRINO_GATEWAY_BUILD_IMAGE} AS packages
32+
33+
RUN \
34+
set -xeuo pipefail && \
35+
mkdir -p /tmp/overlay/usr/libexec/ && \
36+
touch /tmp/overlay/usr/libexec/grepconf.sh && \
37+
chmod +x /tmp/overlay/usr/libexec/grepconf.sh && \
38+
dnf update -y && \
39+
dnf install --installroot /tmp/overlay --setopt install_weak_deps=false --nodocs -y \
40+
less \
41+
zlib `#required by java` \
42+
shadow-utils `# required by useradd` \
43+
tar `# required to support kubectl cp` && \
44+
rm -rf /tmp/overlay/var/cache/*
45+
2946
FROM ${TRINO_GATEWAY_BASE_IMAGE}
3047
WORKDIR /usr/lib/trino-gateway
3148

3249
ARG JDK_RELEASE_NAME
3350
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_RELEASE_NAME}"
3451
ENV PATH=$PATH:$JAVA_HOME/bin
3552
COPY --from=jdk-download $JAVA_HOME $JAVA_HOME
53+
COPY --from=packages /tmp/overlay /
3654

3755
RUN \
3856
set -xeu && \
39-
microdnf update -y && \
40-
microdnf install -y tar less shadow-utils && \
4157
groupadd trino --gid 1000 && \
4258
useradd trino --uid 1000 --gid 1000 --create-home && \
4359
mkdir -p /usr/lib/trino-gateway /etc/trino-gateway && \

docker/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ TAG_PREFIX="trino-gateway:${TRINO_GATEWAY_VERSION}"
107107
#version file is used by the Helm chart test
108108
echo "${TRINO_GATEWAY_VERSION}" > "${SOURCE_DIR}"/trino-gateway-version.txt
109109

110-
TRINO_GATEWAY_BASE_IMAGE=${TRINO_GATEWAY_BASE_IMAGE:-'registry.access.redhat.com/ubi10/ubi-minimal:latest'}
110+
TRINO_GATEWAY_BASE_IMAGE=${TRINO_GATEWAY_BASE_IMAGE:-'registry.access.redhat.com/ubi10/ubi-micro:latest'}
111+
TRINO_GATEWAY_BUILD_IMAGE=${TRINO_GATEWAY_BUILD_IMAGE:-'registry.access.redhat.com/ubi10/ubi:latest'}
111112

112113
for arch in "${ARCHITECTURES[@]}"; do
113114
echo "🫙 Building the image for $arch with Temurin JDK release ${JDK_RELEASE_NAME}"
@@ -118,6 +119,7 @@ for arch in "${ARCHITECTURES[@]}"; do
118119
--build-arg JDK_RELEASE_NAME="${JDK_RELEASE_NAME}" \
119120
--build-arg JDK_DOWNLOAD_LINK="$(temurin_jdk_link "jdk-${JDK_RELEASE_NAME}" "${arch}")" \
120121
--build-arg TRINO_GATEWAY_BASE_IMAGE="${TRINO_GATEWAY_BASE_IMAGE}" \
122+
--build-arg TRINO_GATEWAY_BUILD_IMAGE="${TRINO_GATEWAY_BUILD_IMAGE}" \
121123
--platform "linux/$arch" \
122124
-f Dockerfile \
123125
-t "${TAG_PREFIX}-$arch"

0 commit comments

Comments
 (0)