forked from miguno/java-docker-build-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
91 lines (74 loc) · 2.54 KB
/
justfile
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# This justfile requires https://github.com/casey/just
# Load environment variables from `.env` file.
set dotenv-load
project_dir := justfile_directory()
build_dir := project_dir + "/target"
app_uber_jar := build_dir + "/app-runner.jar"
app_native_image := build_dir + "/app-runner"
# print available targets
default:
@just --list --justfile {{justfile()}}
# evaluate and print all just variables
evaluate:
@just --evaluate
# print system information such as OS and architecture
system-info:
@echo "architecture: {{arch()}}"
@echo "os: {{os()}}"
@echo "os family: {{os_family()}}"
# build the native application locally (requires GraalVM)
build-native:
@echo "Producing a native app image via GraalVM ..."
@echo "See https://quarkus.io/guides/building-native-image#configuring-graalvm"
@./mvnw install -Dnative && echo "The native app image was successfully created at: {{app_native_image}}"
# run the application locally (in Quarkus development mode) with hot reload
dev:
@./mvnw quarkus:dev
# create a docker image (requires Docker)
docker-image-create:
@echo "Creating a docker image ..."
@./create_image.sh
# size of the docker image (requires Docker)
docker-image-size:
@docker images $DOCKER_IMAGE_NAME
# run the docker image (requires Docker)
docker-image-run:
@echo "Running container from docker image ..."
@./start_container.sh
# clean (remove) the build artifacts
clean:
@./mvnw clean
# package the application to create an uber jar
package:
@./mvnw package
# run the application locally
run:
#!/usr/bin/env bash
APP_JAR="{{app_uber_jar}}"
if [ ! -f "$APP_JAR" ]; then
just package
else
echo "Using existing application uber jar at $APP_JAR."
echo "If you want to recompile the uber jar, run \`./mvnw package\` (or \`just package\`) manually."
fi
java -jar "$APP_JAR"
# run the native application locally (requires GraalVM)
run-native:
#!/usr/bin/env bash
APP_BINARY="{{app_native_image}}"
if [ ! -f "$APP_BINARY" ]; then
just build-native
else
echo "Using existing application native image at $APP_BINARY."
echo "If you want to recompile the native image, run \`./mvnw install -Dnative\` (or \`just build-native\`)."
fi
"$APP_BINARY"
# send request to the app's HTTP endpoint (requires running container)
send-request-to-app:
curl http://localhost:8123/status
# run the test suite
test:
@./mvnw test
# run the test suite for the native application (requires GraalVM)
test-native:
@./mvnw verify -Dnative