-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 945 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 945 Bytes
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
CURRENT_DIR := $(shell pwd)
ARCH := $(shell uname -m)
ifeq ($(ARCH),arm64)
ARCH := aarch64
endif
DOCKER_IMAGE_NAME = $(shell basename `pwd`)
DOCKER_ARGS = -it --rm -v `pwd`:/project -w /project -e HF_TOKEN=$(HF_TOKEN)
ifeq ($(shell [ -f "/proc/driver/nvidia/version" ] && echo yes),yes)
DOCKER_ARGS += --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -e HAS_GPU=1
ifeq ($(shell [ -d "/usr/lib/wsl" ] && echo yes),yes)
DOCKER_ARGS += --device /dev/dxg:/dev/dxg -v /usr/lib/wsl:/usr/lib/wsl
endif
endif
DOCKER_ARGS += $(DOCKER_IMAGE_NAME)
default: run
models output_folder:
mkdir $@
chmod a+rwx $@
image: models output_folder
@echo "Building Docker image $(DOCKER_IMAGE_NAME)..."
@docker build . --progress plain -f Dockerfile.$(ARCH) -t $(DOCKER_IMAGE_NAME)
clean:
@docker rmi $(DOCKER_IMAGE_NAME)
run: image
@docker run $(DOCKER_ARGS)
shell: image
@docker run --entrypoint /bin/bash $(DOCKER_ARGS)