-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
85 lines (65 loc) · 1.87 KB
/
Makefile
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
# Use bash as shell
SHELL := /bin/bash
# Get the current git commit hash
GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
# Set the tag to include commit hash
tag ?= $(GIT_COMMIT_HASH)
image_id = ritualnetwork/infernet-node:$(tag)
###########
### DEV ###
###########
# Phony targets
.PHONY: install run deps
# Default: install deps
all: install
# Install dependencies
install:
@uv venv && \
source .venv/bin/activate && \
uv pip install -r requirements.lock
# Update dependencies & generate new lockfile
update-lockfile:
@uv venv && \
source .venv/bin/activate && \
uv pip install -r requirements.txt && \
uv pip freeze > requirements.lock
# Lint code
lint:
@echo "Linting src/"
@ruff check src --fix
@echo "Linting scripts/"
@ruff check scripts --fix
# Type check code
types:
@mypy src/main.py --check-untyped-defs
# Format code
format:
@echo "Formatting src/"
@ruff format src
@echo "Formatting scripts/"
@ruff format scripts
# Run from source
run:
INFERNET_CONFIG_PATH=./deploy/config.json python3.11 src/main.py
# Using docker-compose
run-node:
docker compose -f deploy/docker-compose.yaml up -d
stop-node:
docker compose -f deploy/docker-compose.yaml kill || true
docker compose -f deploy/docker-compose.yaml rm -f || true
restart-node: stop-node run-node
###########
# PUBLISH #
###########
build:
docker build -t $(image_id) .
build-gpu:
docker build -t $(image_id) -f Dockerfile-gpu .
publish:
docker image push $(image_id)
# You may need to set up a docker builder, to do so run:
# docker buildx create --name mybuilder --bootstrap --use
# refer to https://docs.docker.com/build/building/multi-platform/#building-multi-platform-images for more info
build-multiplatform:
docker buildx build --platform linux/amd64,linux/arm64 -t $(image_id) --push .
docker buildx build --platform linux/amd64,linux/arm64 -t $(image_id)-gpu -f Dockerfile-gpu --push .