Dockerfile cleanup
All checks were successful
Productdefinitions Build & Deploy / deploy (push) Successful in 1m23s
All checks were successful
Productdefinitions Build & Deploy / deploy (push) Successful in 1m23s
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -1,34 +1,21 @@
|
||||
# --- Build Stage ---
|
||||
FROM maven:3.9-eclipse-temurin-21 AS build
|
||||
WORKDIR /productdefinitions
|
||||
|
||||
# 1. Abhängigkeiten (External Lib) klonen und installieren
|
||||
RUN git clone -b feature/Produkte --single-branch https://bitbucket.org/omds/omdsservicedefinitions.git /tmp/lib \
|
||||
&& cd /tmp/lib/OMDSServiceDefinition \
|
||||
&& mvn clean install -DskipTests
|
||||
|
||||
# 2. Projekt-Struktur kopieren
|
||||
# Zuerst nur die poms, um den Cache besser zu nutzen (optional, aber empfohlen)
|
||||
COPY pom.xml .
|
||||
COPY server-app/pom.xml server-app/
|
||||
# (Andere Modul-poms hier auch kopieren, falls vorhanden)
|
||||
|
||||
# 3. Den Rest kopieren
|
||||
COPY . .
|
||||
|
||||
# 4. Bauen: Wir installieren das Root-Projekt und bauen dann gezielt das Modul
|
||||
RUN mvn clean install -DskipTests -pl server-app -am
|
||||
|
||||
# --- Run Stage ---
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
|
||||
# Hier liegt der Trick: Wir kopieren gezielt die Datei,
|
||||
# die NICHT ".original" im Namen hat, oder nutzen einen präzisen Namen.
|
||||
# Da 'mvn install' im Modul-Ordner das JAR erzeugt:
|
||||
COPY --from=build /productdefinitions/server-app/target/server-app-*.jar app.jar
|
||||
|
||||
# Debug-Schritt: Zeig uns im Log, ob die Datei da ist und wie groß sie ist
|
||||
RUN ls -lh app.jar
|
||||
EXPOSE 9080
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
Reference in New Issue
Block a user