ICS sample producer and consumer
[nonrtric.git] / sample-services / ics-producer-consumer / producer / Makefile
1 #  ========================LICENSE_START=================================
2 #  O-RAN-SC
3 #
4 #  Copyright (C) 2024: OpenInfra Foundation Europe
5 #  ========================================================================
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #  ============LICENSE_END=================================================
18
19 # Define variables
20 IMAGE_NAME = "o-ran-sc/nonrtric-sample-icsproducer"
21 DOCKERFILE = Dockerfile
22
23 # Default target
24 .PHONY: all
25 all: build run
26
27 # Target to build the Maven JAR
28 .PHONY: jar
29 jar:
30         mvn clean package
31
32 # Target to build the Docker image
33 .PHONY: build
34 build:
35         docker build -t $(IMAGE_NAME) -f $(DOCKERFILE) .
36
37 # Target to run the Docker container
38 .PHONY: run
39 run:
40         docker run -p 8080:8080 $(IMAGE_NAME)
41
42 # Target to stop and remove the Docker container
43 .PHONY: stop
44 stop:
45         docker stop $(IMAGE_NAME) || true
46         docker rm $(IMAGE_NAME) || true
47
48 # Target to clean up
49 .PHONY: clean
50 clean: stop
51         docker rmi $(IMAGE_NAME) || true