-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathjustfile
More file actions
98 lines (80 loc) · 3.2 KB
/
justfile
File metadata and controls
98 lines (80 loc) · 3.2 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
93
94
95
96
97
98
# Aliases
docker_compose := "docker compose"
docker_run := docker_compose + " run \
--volume ${PWD}/app:/code/app \
--volume ${PWD}/tests:/code/tests \
--volume ${PWD}/htmlcov:/code/htmlcov \
--volume ${PWD}/logs:/code/logs \
--volume ${PWD}/static:/code/static \
--publish 8000:8000 \
--rm \
app"
# print recipe names and comments as help
help:
@just --list
# build project images
build:
@echo "Building OverFastAPI (dev mode)..."
BUILD_TARGET="dev" {{ docker_compose }} build
# run OverFastAPI application (dev mode)
start:
@echo "Launching OverFastAPI in dev mode with autoreload..."
{{ docker_run }} uv run fastapi dev app/main.py --host 0.0.0.0
# run OverFastAPI application (testing mode)
start_testing:
@echo "Launching OverFastAPI in testing mode with reverse proxy..."
{{ docker_compose }} --profile testing up -d
# run type checker
check checker_args="":
@echo {{ if checker_args != "" { "Running type checker on " + checker_args + "..." } else { "Running type checker..." } }}
{{ if checker_args != "" { "uv run ty check " + checker_args } else { "uv run ty check" } }}
# run linter
lint:
@echo "Running linter..."
uv run ruff check --fix --exit-non-zero-on-fix
# run formatter
format:
@echo "Running formatter..."
uv run ruff format
# access an interactive shell inside the app container
shell:
@echo "Running shell on app container..."
{{ docker_run }} /bin/sh
# execute a given command inside the app container
exec command="":
@echo "Running command on app container..."
{{ docker_run }} {{ command }}
# run tests, pytest_args can be specified
test pytest_args="":
@echo {{ if pytest_args != "" { "Running tests on " + pytest_args + "..." } else { "Running all tests with coverage..." } }}
{{ docker_run }} {{ if pytest_args != "" { "uv run python -m pytest " + pytest_args } else { "uv run python -m pytest --cov app/ --cov-report html -n auto tests/" } }}
# build & run OverFastAPI application (production mode)
up profile="":
@echo "Building OverFastAPI (production mode)..."
{{ docker_compose }} build
@echo "Stopping OverFastAPI and cleaning containers..."
{{ docker_compose }} down --remove-orphans
@echo "Launching OverFastAPI (production mode)..."
{{ if profile != "" { docker_compose + " --profile " + profile + " up -d" } else { docker_compose + " up -d" } }}
# build & run with monitoring (Prometheus + Grafana)
up_monitoring:
just up monitoring
# stop the app and remove containers (preserves data volumes)
down:
@echo "Stopping OverFastAPI and cleaning containers..."
{{ docker_compose }} --profile "*" down --remove-orphans
# stop the app, remove containers and volumes (clean slate)
down_clean:
@echo "Stopping OverFastAPI and cleaning containers and volumes..."
{{ docker_compose }} --profile "*" down -v --remove-orphans
# clean up Docker environment
clean: down_clean
@echo "Cleaning Docker environment..."
docker image prune -af
docker network prune -f
# update lock file
lock:
uv lock --upgrade
# update test fixtures (heroes, players, etc.)
update_test_fixtures params="":
{{ docker_run }} uv run python -m tests.update_test_fixtures {{ params }}