-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (83 loc) · 1.98 KB
/
Makefile
File metadata and controls
94 lines (83 loc) · 1.98 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
#!/usr/bin/make
## help: Print help.
.PHONY: help
help:
@echo Possible commands:
@cat Makefile | grep '##' | grep -v "Makefile" | sed -e 's/^##/ -/'
## install: Install dependencies.
.PHONY: install
install:
uv venv
uv sync --no-dev
## install_dev: Install dependencies for development.
.PHONY: install_dev
install_dev:
uv venv
uv sync --group dev --group test
uv run pre-commit install
## build_base_bare: Build the base image without any dependencies.
.PHONY: build_base_bare
build_base_bare:
docker build \
--file Dockerfile \
--target base_bare \
--tag api-bare \
--cache-from=api-bare \
--build-arg BUILDKIT_INLINE_CACHE=1 \
${PWD}
## build_base: Build the base image.
.PHONY: build_base
build_base:
docker build \
--file Dockerfile \
--target base \
--tag api \
--cache-from=api-bare \
--cache-from=api \
--build-arg BUILDKIT_INLINE_CACHE=1 \
${PWD}
## build_base_amd: Build the base image for AMD64 architecture.
.PHONY: build_base_amd
build_base_amd:
docker build \
--file Dockerfile \
--target base \
--tag api_amd \
--cache-from=api-bare \
--cache-from=api \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--platform linux/amd64 \
${PWD}
## build_test: Build the test image.
.PHONY: build_test
build_test:
docker build \
--file Dockerfile \
--target test \
--tag api-test \
--cache-from=api-bare \
--cache-from=api \
--cache-from=api-test \
--build-arg BUILDKIT_INLINE_CACHE=1 \
${PWD}
## run_pre_commit: Run pre-commit.
.PHONY: run_pre_commit
run_pre_commit: build_test
docker run --rm \
--volume ${PWD}:/app \
api-test \
-c "pre-commit run --all-files"
## run_tests: Run tests.
.PHONY: run_tests
run_tests: build_test
cd tests; docker-compose up --exit-code-from api
## run_container: Run container.
.PHONY: run_container
run_container: build_test
docker run -it --rm \
--volume ${PWD}/:/app/ \
api-test
## generate_openapi: Generate OpenAPI specification.
.PHONY: generate_openapi
generate_openapi:
python scripts/get_openapi.py