latest build settings
Some checks failed
deploy to hetzner / deploy (push) Has been cancelled

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-08-22 22:01:12 +02:00
parent 2b7450f180
commit 33f29f5141
2 changed files with 32 additions and 13 deletions

View File

@@ -1,7 +1,4 @@
# Stage that builds the application, a prerequisite for the running stage
FROM eclipse-temurin:21-jdk-jammy AS build
ARG SERVICE_ROOT
FROM eclipse-temurin:21-jdk-noble AS build
RUN apt-get update -qq
@@ -11,23 +8,25 @@ WORKDIR /usr/src/app/
RUN chown app:app /usr/src/app/
USER app
# Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies
COPY --chown=app ${SERVICE_ROOT}/gradle/ ./gradle
COPY --chown=app ${SERVICE_ROOT}/gradlew ${SERVICE_ROOT}/build.gradle ${SERVICE_ROOT}/settings.gradle ./
# Copy all needed project files to a folder
COPY --chown=app:app ${SERVICE_ROOT}/src ./src
COPY --chown=app ./.mvn/ .mvn
COPY --chown=app ./mvnw ./pom.xml ./app.json ./
COPY --chown=app ./src ./src
RUN curl -OL https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
# Build the production package
RUN ./gradlew clean build -x test
RUN ./mvnw --batch-mode clean verify -DskipTests
# Running stage: the part that is used for running the application
FROM eclipse-temurin:21-jre-jammy
FROM eclipse-temurin:21-jre-noble
RUN useradd -m app
USER app
COPY --chown=app --from=build /usr/src/app/build/libs/*-SNAPSHOT.jar /usr/app/google.jar
COPY --chown=app --from=build /usr/src/app/target/*.jar /usr/app/google.jar
COPY --chown=app --from=build /usr/src/app/opentelemetry-javaagent.jar /usr/app/opentelemetry-javaagent.jar
HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health || exit 1
EXPOSE 8080
CMD ["java", "-jar", "/usr/app/google.jar"]