4885a48378af860056385a3b058a01dad96af93c
[nonrtric.git] / sample-services / hello-world-sme-invoker / Dockerfile
1 #==================================================================================
2 #   Copyright (C) 2024: OpenInfra Foundation Europe
3 #
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
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15 #
16 #   This source code is part of the near-RT RIC (RAN Intelligent Controller)
17 #   platform project (RICP).
18 #==================================================================================
19
20
21 # Use Maven image with OpenJDK 17 for the build stage
22 FROM maven:3.8.5-openjdk-17 AS maven_build
23
24 # Copy Maven project files
25 COPY pom.xml /tmp/
26 COPY src /tmp/src/
27
28 # Set working directory
29 WORKDIR /tmp/
30
31 # Build the Maven project
32 RUN mvn package
33
34 # Use a separate image with OpenJDK 17 for the runtime stage
35 FROM openjdk:17-jdk-slim
36
37 # Expose port 8080
38 EXPOSE 8080
39
40 # Set the working directory
41 WORKDIR /app
42
43 # Copy the JAR file from the maven_build stage to the runtime stage
44 COPY --from=maven_build /tmp/target/hello-world-sme-invoker-0.1.0.jar /app/hello-world-sme-invoker-0.1.0.jar
45
46 # Command to run the application
47 CMD ["java", "-jar", "hello-world-sme-invoker-0.1.0.jar"]