Hi all,
Recently switched over from the Python wrapper of Orekit to the Java version. I have my development environment set up in VS Code and am using Maven and the Jersey rest API framework. I saw that OreCzml came out and immediately got super excited to make use of it (I wrote a very bootleg CZML writer when I was using the Python wrapper). Now, it’s not available in the central Maven repository, so in order to include it as a dependency in my docker container, I have modified my dockerfile to copy over a local maven repository where I have stored it (and cesiumlanguagewriter 3.0). I’ll include a copy of my dockerfile below for reference. When attempting to build my docker image, I’m met with a build failure and an error that suggests the pom.xml for OreCzml uses compiler target and source of java 17; the rest of the project (Orekit, cesiumlanguagewriter), including the container itself via the dockerfile, uses Java 8. I clone the source code repo for OreCzml and attempt to switch the compiler settings in the pom.xml to 8, but now the project won’t compile into a jar, due to 80-something instances of “.of()” methods (added in Java 9), as well as a couple other errors. All can be replaced with functionalities supported by Java 8 so I’ve been working my way through that, but is there something I’m missing to accomplish this goal without this nuance? Why would there be Java 9+ methods in this project? Why does it allow me to use the packages in my development environment but throws a fit when I try to build the same dependencies into a docker image? As far as JDK on my local machine, I have the path set to my Java 8 JDK, but have a 17 JDK installed elsewhere for some of my VS Code extensions to look at. Unsure if there’s a more desirable configuration there, or if I need to somehow instruct the dockerfile (and include) to use 17 for compiling the OreCzml package. Any insight at all would be wonderful! Thank you in advance Can provide more context if needed!
# Stage 1: Build the application
FROM maven:3.8.5-jdk-8-slim AS builder
# Set the working directory for the application
WORKDIR /app
# Copy source code- (including pom.xml) into container
COPY . .
# Copy the custom local Maven repository from host/build machine into the container
# Adjust the localMavenRepo path to the correct location in the project
COPY ./localMavenRepo /root/.m2/repository
# Run Maven build, specifying the custom local repository using -Dmaven.repo.local
RUN mvn clean package -DskipTests -Dmaven.repo.local=/root/.m2/repository
# Stage 2: Run the application
FROM openjdk:8-jdk-alpine
# Set the working directory for the runtime environment
WORKDIR /app
# Copy the jar file from the builder stage
COPY --from=builder /app/target/orekitjersey-0.0.7.jar app.jar
# Copy the orekit-data dependency folder (or other resources as needed)
COPY ./orekit-data/ /app/orekit-data/
# Expose port 8080
EXPOSE 8080
# Define the command to run the app
ENTRYPOINT ["java", "-jar", "app.jar"]