-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (68 loc) · 1.94 KB
/
Copy pathMakefile
File metadata and controls
83 lines (68 loc) · 1.94 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
.SILENT:
.NOTPARALLEL:
## Settings
.DEFAULT_GOAL := help
## Colors
COLOR_RESET = \033[0m
COLOR_INFO = \033[32m
COLOR_COMMENT = \033[33m
COLOR_MAGENTA = \033[35m
export RUN_AS_USER=$(shell id -u)
include .env
export
## Help
help:
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
printf " make [target]\n\n"
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_INFO}%-30s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## Build / update containers
container@build:
docker compose pull
docker compose build --pull
docker compose run --rm -u root app sh -c "chown $(RUN_AS_USER):$(RUN_AS_USER) -R /opt/venv/"
docker compose run --rm app sh -c "rm -Rf /opt/venv/* && uv sync"
.PHONY: container@build
## Start containers
container@start:
docker compose up -d --remove-orphans
.PHONY: container@start
## Stop containers
container@stop:
docker compose down --remove-orphans
.PHONY: container@stop
## Restart containers
container@restart: container@stop container@start
.PHONY: container@restart
## Console
container@console:
docker compose exec app uv run --no-sync bash
.PHONY: container@console
## Logs
container@logs:
docker compose logs -f
.PHONY: container@logs
## Build (DEV)
project@build-dev: container@start
docker compose run --rm app uv run --no-sync poe build-dev
.PHONY: project@build-dev
## Build (PROD)
project@build: container@start
docker compose run --rm app uv run --no-sync poe build
.PHONY: project@build
## Run tests
project@test: container@start
docker compose run --rm app uv run --no-sync poe test
.PHONY: project@test
## Lint and format code
project@format:
docker compose exec -T app uv run --no-sync poe format
.PHONY: project@format