-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (54 loc) · 1.2 KB
/
Copy pathMakefile
File metadata and controls
70 lines (54 loc) · 1.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
PYPIRC=~/.pypirc.fscherf
.PHONY: \
all clean build \
docker-build docker-pull \
ollama ollama-bash ollama-pull \
python-shell python-build \
_pypi-upload
define DOCKER_COMPOSE_UP
docker compose up \
--remove-orphans \
$1
endef
define DOCKER_COMPOSE_RUN
docker compose run \
-it \
--user=$$(id -u):$$(id -g) \
--remove-orphans \
--service-ports \
$1 $2
endef
define DOCKER_COMPOSE_EXEC
docker compose exec \
-it \
--user=$$(id -u):$$(id -g) \
$1 $2
endef
# meta
all: python-shell
clean:
rm -rf .venv build dist *.egg-info
build: docker-build python-build
# docker
docker-build:
docker compose build --no-cache ${args}
docker-pull:
docker compose pull
# ollama
ollama:
$(call DOCKER_COMPOSE_UP,ollama)
ollama-bash:
$(call DOCKER_COMPOSE_RUN,--entrypoint bash,ollama)
ollama-pull:
$(call DOCKER_COMPOSE_EXEC,ollama,/app/ollama/pull.sh)
# python
python-shell:
$(call DOCKER_COMPOSE_RUN,python)
python-bash:
$(call DOCKER_COMPOSE_RUN,python,bash)
python-build:
rm -rf build dist *.egg-info && \
$(call DOCKER_COMPOSE_RUN,python,python -m build)
# releases
_pypi-upload:
$(call DOCKER_COMPOSE_RUN,-v ${PYPIRC}:/.pypirc,python twine upload --config-file /.pypirc dist/* --verbose)