1 #==================================================================================
2 # Copyright (C) 2024: OpenInfra Foundation Europe
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # This source code is part of the near-RT RIC (RAN Intelligent Controller)
17 # platform project (RICP).
18 #==================================================================================
20 # Use Maven image with OpenJDK 17 for the build stage
21 FROM maven:3.8.5-openjdk-17 AS maven_build
23 # Copy Maven project files
27 # Set working directory
30 # Build the Maven project
33 # Use a separate image with OpenJDK 17 for the runtime stage
34 FROM openjdk:17-jdk-slim
40 ENV KAFKA_SERVERS=${KAFKA_SERVERS}
42 # Set the working directory
45 # Copy the JAR file from the maven_build stage to the runtime stage
46 COPY --from=maven_build /tmp/target/producer-0.0.1.jar /app/producer-0.0.1.jar
48 # Command to run the application
49 CMD ["java", "-jar", "producer-0.0.1.jar"]