# Build stage FROM maven:3.8.4-eclipse-temurin-11 AS builder WORKDIR /app # Copy pom.xml COPY pom.xml . # Copy source code COPY src ./src # Copy SDK jar file and param.dat COPY JavaSDKV2.2.2 ./JavaSDKV2.2.2 # Build the application (skip tests and test compilation) RUN mvn clean package -DskipTests -Dmaven.test.skip=true # Final stage FROM eclipse-temurin:11-jre-alpine WORKDIR /app # Copy the jar file from builder stage (assembly plugin creates jar-with-dependencies) COPY --from=builder /app/target/sensor-bridge-1.0.0-jar-with-dependencies.jar ./sensor-bridge.jar # Copy SDK jar file to runtime COPY --from=builder /app/JavaSDKV2.2.2/RSNetDevice-2.2.2.jar ./libs/ # Copy param.dat to the expected location COPY --from=builder /app/JavaSDKV2.2.2/param.dat ./JavaSDKV2.2.2/param.dat # Expose port EXPOSE 8020 # Run the application with classpath including SDK CMD ["java", "-cp", "sensor-bridge.jar:libs/*", "com.sensor.bridge.SensorBridge"]