-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile.template
77 lines (68 loc) · 3.94 KB
/
Dockerfile.template
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# vim:set ft=dockerfile:
# Do not edit individual Dockerfiles manually. Instead, please make changes to the Dockerfile.template, which will be used by the build script to generate Dockerfiles.
# By policy, the base image tag should be a quarterly tag unless there's a
# specific reason to use a different one. This means January, April, July, or
# October.
FROM cimg/%%PARENT%%:2024.02
LABEL maintainer="CircleCI Execution Team <[email protected]>"
ENV JAVA_VERSION=%%MAIN_VERSION%%
ENV JAVA_HOME=/usr/local/jdk-${JAVA_VERSION}
RUN [[ $(uname -m) == "x86_64" ]] && ARCH="x64" || ARCH="aarch64" && \
JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | cut -d '.' -f 1) && \
JAVA_PATCH_VERSION=$(echo "$JAVA_VERSION" | cut -d '.' -f 3) && \
if [ "$JAVA_MAJOR_VERSION" = "8" ]; then \
JAVA_BUILD=$(curl -s "https://api.github.com/repos/adoptium/temurin8-binaries/releases" | jq ".[] | select(.tag_name | startswith(\"jdk8u${JAVA_PATCH_VERSION}\")) | select(.tag_name | contains(\"-beta\") | not) | .tag_name" | tr -d '"'); \
JAVA_BUILD="${JAVA_BUILD/jdk8u/}"; \
JAVA_BUILD_SANITISED="${JAVA_BUILD//-/}"; \
URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u${JAVA_BUILD}/OpenJDK8U-jdk_${ARCH}_linux_hotspot_8u${JAVA_BUILD_SANITISED}.tar.gz"; \
else \
JAVA_BUILD=$(curl -s "https://api.github.com/repos/adoptium/temurin${JAVA_MAJOR_VERSION}-binaries/releases" | jq "limit(1; .[] | select(.tag_name | startswith(\"jdk-${JAVA_VERSION}+\"))) | .tag_name | split(\"+\")[1]" | tr -d '"'); \
URL="https://github.com/adoptium/temurin${JAVA_MAJOR_VERSION}-binaries/releases/download/jdk-${JAVA_VERSION}%2B${JAVA_BUILD%.*}/OpenJDK${JAVA_MAJOR_VERSION}U-jdk_${ARCH}_linux_hotspot_${JAVA_VERSION}_${JAVA_BUILD%.*}.tar.gz"; \
fi && \
curl -sSL -o java.tar.gz "${URL}" && \
sudo mkdir /usr/local/jdk-${JAVA_VERSION} && \
sudo tar -xzf java.tar.gz --strip-components=1 -C /usr/local/jdk-${JAVA_VERSION} && \
rm java.tar.gz && \
if [[ "$JAVA_VERSION" == *"0.0"* ]]; then \
sudo ln -s /usr/local/jdk-${JAVA_VERSION} /usr/local/jdk-%%VERSION_MAJOR%%; \
fi && \
sudo ln -s /usr/local/jdk-${JAVA_VERSION}/bin/* /usr/bin/ && \
sudo mkdir -p /etc/ssl/certs/java/cacerts && \
sudo ln -s ${JAVA_HOME}/lib/security/cacerts /etc/ssl/certs/java/cacerts && \
# Install packages to help with legacy image migration
sudo apt-get update && sudo apt-get install -y \
fontconfig \
&& \
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
# The dual version command is to support OpenJDK 8
java --version || java -version && \
javac --version || javac -version
ENV MAVEN_VERSION=3.9.9 \
PATH=/opt/apache-maven/bin:$PATH
RUN dl_URL="https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" && \
curl -sSL --fail --retry 3 $dl_URL -o apache-maven.tar.gz && \
sudo tar -xzf apache-maven.tar.gz -C /opt/ && \
rm apache-maven.tar.gz && \
sudo ln -s /opt/apache-maven-* /opt/apache-maven && \
mvn --version
ENV GRADLE_VERSION=8.10.2 \
PATH=/opt/gradle/bin:$PATH
RUN dl_URL="https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" && \
curl -sSL --fail --retry 3 $dl_URL -o gradle.zip && \
sudo unzip -d /opt gradle.zip && \
rm gradle.zip && \
sudo ln -s /opt/gradle-* /opt/gradle && \
gradle --version
ENV SBT_VERSION=1.10.2 \
PATH=/opt/sbt/bin:$PATH
ENV MILL_VERSION=0.11.12
RUN dl_URL="https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz" && \
curl -sSL --fail --retry 3 $dl_URL -o sbt.tar.gz && \
sudo tar -xzf sbt.tar.gz -C /opt/ && \
sudo ln -s /opt/sbt-* /opt/sbt && \
sbt about && \
rm -rf sbt.tar.gz ~/project/project ~/project/target && \
# install mill docs: http://mill-build.com/mill/Installation_IDE_Support.html#_mills_bootstrap_script_linuxos_x_only
mill_URL="https://github.com/com-lihaoyi/mill/releases/download/${MILL_VERSION}/${MILL_VERSION}" && \
curl -sSL --fail --retry 3 $mill_URL > mill && \
sudo mv mill /usr/local/bin/mill && chmod +x /usr/local/bin/mill