-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
87 lines (73 loc) · 2.58 KB
/
makefile
File metadata and controls
87 lines (73 loc) · 2.58 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
CURRENT_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
# Python variables:
PYTHON_VERSION = 3.13
# Docker variables:
DOCKER_DIR = ./docker
DOCKER_FILE = $(DOCKER_DIR)/Dockerfile
DOCKER_FILE_DEVCONTAINER = $(DOCKER_DIR)/Dockerfile.dev
DOCKER_TAG = kaszanas/sc2anonserverpy
DEVCONTAINER = kaszanas/sc2anonserverpy-devcontainer
############################
#### Using the tools #######
############################
.PHONY: run
run_server: ## Run the server
@echo "Running the gRPC anonymization server"
@echo "Using the Docker image: $(DOCKER_TAG)"
docker run --rm \
-v ".\processing:/app/processing" \
-p 9999:9999 \
$(DOCKER_TAG) \
python3 grpc_server.py \
--anonymized-db-path /app/processing/anonymized_players.pickle
.PHONY: run_client
run_client: ## Run the client without multiprocessing
@echo "Running the gRPC anonymization client"
@echo "Using the Docker image: $(DOCKER_TAG)"
docker run --rm \
-v ".\processing:/app/processing" \
--network host \
$(DOCKER_TAG) \
python3 grpc_client.py \
--replay-directory /app/processing/demos/input \
--output-directory /app/processing/demos/output \
--agents 1 \
--chunksize 1 \
--multiprocessing
############################
#### Docker commands #######
############################
.PHONY: docker_build
docker_build: ## Builds the image containing all of the tools.
@echo "Building the Dockerfile: $(DOCKER_FILE)"
@echo "Using Python version: $(PYTHON_VERSION)"
docker build \
--build-arg="PYTHON_VERSION=$(PYTHON_VERSION)" \
-f $(DOCKER_FILE) . \
--tag=$(DOCKER_TAG)
.PHONY: docker_run_it
docker_run_it: ## Run the container in interactive mode
docker run -it --rm $(DOCKER_TAG)
.PHONY: docker_build_devcontainer
docker_build_devcontainer: ## Builds the devcontainer image.
@echo "Building the Dockerfile: $(DOCKER_FILE_DEVCONTAINER)"
@echo "Setting tag to: $(DEVCONTAINER)"
@echo "Using Python version: $(PYTHON_VERSION)"
docker build \
--build-arg="PYTHON_VERSION=$(PYTHON_VERSION)" \
-f $(DOCKER_FILE_DEVCONTAINER) . \
--tag=$(DEVCONTAINER)
############################
#### GitHub Actions ########
############################
.PHONY: docker_pre_commit_action
docker_pre_commit_action: ## Runs pre-commit hooks using Docker.
@echo "Running pre-commit hooks using Docker."
@make docker_build_devcontainer
@echo "Using the devcontainer image: $(DEVCONTAINER)"
docker run \
$(DEVCONTAINER) \
pre-commit run --all-files
.PHONY: help
help: ## Show available make targets
@awk '/^[^\t ]*:.*?##/{sub(/:.*?##/, ""); printf "\033[36m%-30s\033[0m %s\n", $$1, substr($$0, index($$0,$$2))}' $(MAKEFILE_LIST)