forked from kroxylicious/kroxylicious
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (51 loc) · 2.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# Copyright Kroxylicious Authors.
#
# Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
#
FROM registry.access.redhat.com/ubi9/openjdk-17:1.20 AS builder
USER root
WORKDIR /opt/kroxylicious
COPY . .
RUN mvn -q -B clean package -Pdist -Dquick
USER 185
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.2
ARG JAVA_VERSION=17
ARG TARGETOS
ARG TARGETARCH
ARG KROXYLICIOUS_VERSION
ARG CURRENT_USER
ARG CURRENT_USER_UID
RUN microdnf -y update \
&& microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JAVA_VERSION}-openjdk-headless openssl shadow-utils \
&& microdnf clean all
ENV JAVA_HOME /usr/lib/jvm/jre-17
#####
# Add Tini
#####
ENV TINI_VERSION v0.19.0
ENV TINI_SHA256_AMD64=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c
ENV TINI_SHA256_ARM64=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ENV TINI_SHA256_PPC64LE=3f658420974768e40810001a038c29d003728c5fe86da211cff5059e48cfdfde
ENV TINI_SHA256_S390X=931b70a182af879ca249ae9de87ef68423121b38d235c78997fafc680ceab32d
RUN set -ex; \
if [[ "${TARGETOS}/${TARGETARCH}" = "linux/ppc64le" ]]; then \
curl -s -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-ppc64le -o /usr/bin/tini; \
echo "${TINI_SHA256_PPC64LE} */usr/bin/tini" | sha256sum -c; \
chmod +x /usr/bin/tini; \
elif [[ "${TARGETOS}/${TARGETARCH}" = "linux/arm64" ]]; then \
curl -s -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-arm64 -o /usr/bin/tini; \
echo "${TINI_SHA256_ARM64} */usr/bin/tini" | sha256sum -c; \
chmod +x /usr/bin/tini; \
elif [[ "${TARGETOS}/${TARGETARCH}" = "linux/s390x" ]]; then \
curl -s -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-s390x -o /usr/bin/tini; \
echo "${TINI_SHA256_S390X} */usr/bin/tini" | sha256sum -c; \
chmod +x /usr/bin/tini; \
else \
curl -s -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini -o /usr/bin/tini; \
echo "${TINI_SHA256_AMD64} */usr/bin/tini" | sha256sum -c; \
chmod +x /usr/bin/tini; \
fi
COPY --from=builder /opt/kroxylicious/kroxylicious-app/target/kroxylicious-app-${KROXYLICIOUS_VERSION}-bin/kroxylicious-app-${KROXYLICIOUS_VERSION}/ /opt/kroxylicious/
RUN if [[ -n "${CURRENT_USER}" && "${CURRENT_USER}" != "root" ]] ; then groupadd -r -g "${CURRENT_USER_UID}" "${CURRENT_USER}" && useradd -m -r -u "${CURRENT_USER_UID}" -g "${CURRENT_USER}" "${CURRENT_USER}"; fi
ENTRYPOINT ["/usr/bin/tini", "--", "/opt/kroxylicious/bin/kroxylicious-start.sh" ]