forked from kasia-kittel/Spring4ShellExample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 815 Bytes
/
Copy pathMakefile
File metadata and controls
39 lines (30 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
APP_NAME = spring4shell-demo
IMAGE_NAME = test-app
CONTAINER_NAME = test-app
.PHONY: build package docker-build run stop clean shell logs check-shell restart
# Build Java project
build:
mvn clean package -DskipTests
# Build Docker image (builds Java first)
# Podman needs to be aliased as docker
docker-build: build
podman build -t $(IMAGE_NAME) .
# Run container
run: docker-build
podman run -d --name $(CONTAINER_NAME) -p 8080:8080 $(IMAGE_NAME)
# Stop and remove container
stop:
podman stop $(CONTAINER_NAME) || true
podman rm $(CONTAINER_NAME) || true
# Clean everything
clean: stop
mvn clean
podman rmi $(IMAGE_NAME) || true
# Shell into container
shell:
podman exec -it $(CONTAINER_NAME) /bin/bash
# View container logs
logs:
podman logs -f $(CONTAINER_NAME)
# Full restart
restart: stop run