forked from grimmory-tools/grimmory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
92 lines (75 loc) · 3.14 KB
/
Justfile
File metadata and controls
92 lines (75 loc) · 3.14 KB
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
92
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
mod api 'booklore-api/Justfile'
mod ui 'frontend/Justfile'
mod release 'tools/release/Justfile'
compose_file := env_var_or_default('GRIMMORY_COMPOSE_FILE', 'dev.docker-compose.yml')
compose_cmd := 'docker compose -f ' + compose_file
db_service := 'backend_db'
local_image_tag := env_var_or_default('GRIMMORY_IMAGE_TAG', 'grimmory:local')
local_container_name := 'grimmory-local'
local_db_url := 'jdbc:mariadb://localhost:3366/grimmory?createDatabaseIfNotExist=true'
local_db_user := 'grimmory'
local_db_password := 'grimmory'
# Show the primary developer and agent command surface, including submodule recipes.
help:
@just --list --list-submodules
# List recipes in a specific module, for example `just list api` or `just list ui`.
list module='':
@if [[ -n "{{ module }}" ]]; then \
just --list "{{ module }}"; \
else \
just --list --list-submodules; \
fi
# Install the common local prerequisites used by the UI and API workflows.
bootstrap: ui::install api::version
# Run the full local verification pass used before opening a PR.
check: api::check ui::check
# Run the frontend and backend test suites.
test: api::test ui::test
# Build both application components without publishing a container image.
build: api::build ui::build
# Start the Docker-based development stack in the foreground.
dev-up:
{{ compose_cmd }} up
# Start the Docker-based development stack in the background.
dev-up-detached:
{{ compose_cmd }} up -d
# Start only the development database service from the compose stack.
db-up:
{{ compose_cmd }} up -d {{ db_service }}
# Stop only the development database service from the compose stack.
db-down:
{{ compose_cmd }} stop {{ db_service }}
# Stop the Docker-based development stack.
dev-down:
{{ compose_cmd }} down
# Tail logs from the full dev stack or a single service with `just dev-logs backend`.
dev-logs service='':
@if [[ -n "{{ service }}" ]]; then \
{{ compose_cmd }} logs -f "{{ service }}"; \
else \
{{ compose_cmd }} logs -f; \
fi
# Build the production image locally with buildx. Usage: `just image-build [platform] [tag]`.
image-build platform='linux/amd64' tag=local_image_tag:
docker buildx build --platform "{{ platform }}" -t "{{ tag }}" --load .
# Run the locally built production image against the expected development defaults.
image-run tag=local_image_tag db_url=local_db_url db_user=local_db_user db_password=local_db_password:
docker run --rm -it \
--name "{{ local_container_name }}" \
--network host \
-e "SPRING_DATASOURCE_URL={{ db_url }}" \
-e "SPRING_DATASOURCE_USERNAME={{ db_user }}" \
-e "SPRING_DATASOURCE_PASSWORD={{ db_password }}" \
-v ./shared/data:/app/data \
-v ./shared/books:/books \
-v ./shared/bookdrop:/bookdrop \
-p 6060:6060 \
"{{ tag }}"
# Show the resolved tool versions that the local commands expect to find.
doctor:
@echo "just: $$(just --version)"
@echo "java: $$(java -version 2>&1 | head -n 1)"
@echo "node: $$(node --version)"
@echo "yarn: $$(corepack yarn --version)"
@echo "docker: $$(docker --version)"