Skip to content
Snippets Groups Projects
Commit 48abd5c5 authored by michaelyoukeim's avatar michaelyoukeim
Browse files

Updated the docker config with java6 and java7

parent 78c079a1
No related branches found
No related tags found
No related merge requests found
# Use a Debian base image
FROM debian:buster-slim
FROM ubuntu:latest
# Update the system and install necessary tools
RUN apt-get update && apt-get install -y \
# Install necessary packages for adding repositories
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
wget \
curl \
software-properties-common \
gnupg \
&& rm -rf /var/lib/apt/lists/*
git \
software-properties-common \
python3 \
python3-pip
# Install OpenJDK 8 and 11 from Debian's package manager
RUN apt-get update && apt-get install -y openjdk-8-jdk openjdk-11-jdk
# Add the Temurin repository and install Java
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor > /usr/share/keyrings/temurin-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/temurin-archive-keyring.gpg] https://packages.adoptium.net/artifactory/deb/ buster main" | tee /etc/apt/sources.list.d/temurin.list \
&& apt-get update
# Add AdoptOpenJDK's repository to install Java 20
RUN wget -O - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - \
&& add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ \
&& apt-get update && apt-get install -y adoptopenjdk-20-hotspot
# Install OpenJDK 8, 11, and other JDKs as required
RUN apt-get install -y temurin-8-jdk temurin-11-jdk temurin-21-jdk
# Manually install Java 6 and 7
COPY jdk-6u45-linux-x64.tar.gz jdk-7u80-linux-x64.tar.gz /tmp/
COPY lib/java_archives/jdk-6u45-linux-x64.tar.gz lib/java_archives/jdk-7u75-linux-x64.tar.gz /tmp/
RUN tar -xzf /tmp/jdk-6u45-linux-x64.tar.gz -C /usr/lib/jvm/ && \
tar -xzf /tmp/jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm/ && \
tar -xzf /tmp/jdk-7u75-linux-x64.tar.gz -C /usr/lib/jvm/ && \
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 100 && \
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_80/bin/java 200
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-se-7u75-ri/bin/java 200
# Cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
......
version: '3.8'
services:
myapp:
hadoop_analysis_app:
build:
context: .
dockerfile: Dockerfile
......
File added
File added
......@@ -33,7 +33,7 @@ def switch_java_version(java_version):
try:
# Switch the Java version
subprocess.run(
["sudo", "update-java-alternatives", "-s", target_version], check=True
["update-java-alternatives", "-s", target_version], check=True
)
print(f"Switched to Java version: {target_version}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment