Skip to content
Snippets Groups Projects
Commit 78c079a1 authored by Michael Youkeim's avatar Michael Youkeim
Browse files

Added docker configs

parent cec66d0e
No related branches found
No related tags found
No related merge requests found
# Use Debian as the base image
# Use a Debian base image
FROM debian:buster-slim
# Install Python, Java, Maven and other required tools
# Update the system and install necessary tools
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
openjdk-8-jdk \
maven \
git \
wget \
curl \
software-properties-common \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# Set Python 3 as the default Python version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# Install OpenJDK 8 and 11 from Debian's package manager
RUN apt-get update && apt-get install -y openjdk-8-jdk openjdk-11-jdk
# Set the working directory
WORKDIR /app
# 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
# Manually install Java 6 and 7
COPY jdk-6u45-linux-x64.tar.gz jdk-7u80-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/ && \
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
# Cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy the application source code to the Docker image
# Set the default Java
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV PATH $JAVA_HOME/bin:$PATH
# Set the working directory and copy your app
WORKDIR /app
COPY . .
# Install Python dependencies
RUN pip3 install -r requirements.txt
# Command to run on container start
CMD ["python", "src/hadoop_analysis/main.py"]
# Keep the container running
CMD ["tail", "-f", "/dev/null"]
version: '3.8'
services:
myapp:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- maven_repo:/root/.m2
- ../hadoop:/hadoop
environment:
- JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
command: tail -f /dev/null # Keeps the container running
volumes:
maven_repo:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment