Commit 16f28557 authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

change Dockerfile to accept the jar file from the target dir (previous pipeline stage)

parent a025e87c
Loading
Loading
Loading
Loading
Loading
+5 −19
Original line number Original line Diff line number Diff line
# ---------- Stage 1: Build ----------
FROM maven:3.9-eclipse-temurin-17 AS builder
WORKDIR /app

# Copy pom.xml and download dependencies first (cache layer)
COPY pom.xml .
RUN mvn dependency:go-offline -B

# Copy the rest of the source code
COPY src ./src

# Build the Spring Boot executable JAR
RUN mvn clean package -DskipTests

# ---------- Stage 2: Runtime ----------
FROM eclipse-temurin:17-jre-alpine
FROM eclipse-temurin:17-jre-alpine
MAINTAINER osl.etsi.org



# Create application directory
# Create application directory
RUN mkdir -p /opt/openslice/lib/
RUN mkdir -p /opt/openslice/lib/


# Copy the built JAR from the builder stage
# Copy the built JAR from a previous pipeline
COPY --from=builder /app/target/org.etsi.osl.mcp.backend-0.0.1-SNAPSHOT.jar /opt/openslice/lib/app.jar
COPY /target/org.etsi.osl.mcp.backend-1.0.0-SNAPSHOT.jar /opt/openslice/lib

# Expose port
# Expose port
EXPOSE 11880
EXPOSE 11880


@@ -29,4 +15,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD wget --no-verbose --tries=1 --spider http://localhost:11880/actuator/health || exit 1
    CMD wget --no-verbose --tries=1 --spider http://localhost:11880/actuator/health || exit 1


# Run application
# Run application
CMD ["java", "-jar", "/opt/openslice/lib/app.jar"]
CMD ["java", "-jar", "/opt/openslice/lib/org.etsi.osl.mcp.backend-1.0.0-SNAPSHOT.jar"]