1
- # Stage 1: Build the application
2
- FROM maven:3-eclipse-temurin-21 as builder
1
+ FROM maven:3-eclipse-temurin-21 as jar_builder
3
2
4
3
# Set the working directory in the Maven image
5
4
WORKDIR /app
@@ -11,15 +10,29 @@ COPY pom.xml .
11
10
# Build the application
12
11
RUN mvn clean package -DskipTests
13
12
14
- FROM python:3.11
13
+ FROM maven:3-eclipse-temurin-21
14
+
15
+ # download system dependencies first to take advantage of docker caching
16
+ RUN apt-get update; apt-get install -y --no-install-recommends \
17
+ build-essential \
18
+ default-mysql-client \
19
+ default-libmysqlclient-dev \
20
+ python3 \
21
+ python3-setuptools \
22
+ python3-dev \
23
+ python3-pip \
24
+ unzip \
25
+ perl \
26
+ && rm -rf /var/lib/apt/lists/* \
27
+ && pip3 install wheel
15
28
16
29
# Install any needed packages specified in requirements.txt
17
30
COPY requirements.txt ./
18
31
RUN pip install --no-cache-dir -r requirements.txt
19
32
20
- # Install Perl. Some scripts are written in perl
21
- RUN apt-get update && apt-get install -y perl
33
+ RUN ln -s $(which python3) /usr/local/bin/python || true
22
34
35
+ COPY --from=jar_builder /app/core-*.jar /
23
36
COPY scripts/ scripts/
24
37
RUN chmod -R a+x /scripts/
25
38
@@ -28,25 +41,5 @@ WORKDIR /scripts/
28
41
29
42
ENV PORTAL_HOME=/
30
43
31
- COPY --from=builder /app/core-*.jar /
32
- # Set environment variables for Java version and installation paths
33
- ENV JAVA_VERSION 21
34
- ENV JAVA_HOME /usr/java/openjre-$JAVA_VERSION
35
-
36
- # Install necessary packages for adding repositories over HTTPS
37
- RUN apt-get update && \
38
- apt-get install -y --no-install-recommends apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common && \
39
- rm -rf /var/lib/apt/lists/*
40
-
41
- # Download and install OpenJRE 21
42
- # Note: The exact URL might change based on the latest available version, so replace it with the correct URL for JRE 21
43
- RUN mkdir -p "$JAVA_HOME" && \
44
- wget -O jdk21.tar.gz "https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz" && \
45
- tar xvf jdk21.tar.gz --strip-components=1 -C "$JAVA_HOME" && \
46
- rm jdk21.tar.gz
47
-
48
- # Add java to PATH
49
- ENV PATH $JAVA_HOME/bin:$PATH
50
-
51
44
# This file is empty. It has to be overriden by bind mounting the actual application.properties
52
45
RUN touch /application.properties
0 commit comments