-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (36 loc) · 1.76 KB
/
Dockerfile
File metadata and controls
46 lines (36 loc) · 1.76 KB
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
# Build anchor-platform-runner.jar
ARG BASE_IMAGE=gradle:8.2.1-jdk17
FROM ${BASE_IMAGE} AS build
WORKDIR /code
COPY --chown=gradle:gradle . .
RUN gradle --no-daemon clean bootJar -Pkotlin.compiler.execution.strategy=in-process --stacktrace -x test
# Build final image
FROM ubuntu:24.04
ARG JDK_VER=17.0.16_8
ARG TEMURIN_RELEASE=jdk-17.0.16+8
ARG TARGETARCH=amd64
RUN bash -c 'echo "Building for arch: $TARGETARCH"'
# Install curl and ca-certificates
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates tar unzip \
&& rm -rf /var/lib/apt/lists/*
# ---- Install Temurin JDK 17.0.16+8 ----
RUN case "$TARGETARCH" in \
amd64|x86_64) DOWNLOAD_URL="https://github.com/adoptium/temurin17-binaries/releases/download/${TEMURIN_RELEASE}/OpenJDK17U-jdk_x64_linux_hotspot_${JDK_VER}.tar.gz" ;; \
arm64|aarch64) DOWNLOAD_URL="https://github.com/adoptium/temurin17-binaries/releases/download/${TEMURIN_RELEASE}/OpenJDK17U-jdk_aarch64_linux_hotspot_${JDK_VER}.tar.gz" ;; \
*) echo "Unsupported arch: '$arch'"; exit 1 ;; \
esac && \
echo "JDK DOWNLOAD_URL: $DOWNLOAD_URL" && \
curl -fsSL -H "User-Agent: curl" -o /tmp/openjdk17.tar.gz "$DOWNLOAD_URL" && \
mkdir -p /usr/lib/jvm && \
tar -xzf /tmp/openjdk17.tar.gz -C /usr/lib/jvm && \
ln -s /usr/lib/jvm/${TEMURIN_RELEASE} /usr/lib/jvm/temurin-17 && \
ln -s /usr/lib/jvm/temurin-17/bin/java /usr/bin/java
# Make Java available via JAVA_HOME and PATH
ENV JAVA_HOME=/usr/lib/jvm/temurin-17
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# Sanity check
RUN java --version
COPY --from=build /code/service-runner/build/libs/anchor-platform-runner*.jar /app/anchor-platform-runner.jar
COPY --from=build /code/scripts/docker-start.sh /app/start.sh
ENTRYPOINT ["/bin/bash", "/app/start.sh"]