-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (51 loc) · 1.43 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
PYTHON ?= python3
PREF_SHELL ?= bash
GITREF=$(shell git rev-parse --short HEAD)
GITREF_FULL=$(shell git rev-parse HEAD)
####################################
# Docker image & dist
####################################
IMG_ORG ?= enho
IMG_NAME ?= dotfiles
IMG_TAG ?= test
IMG ?= "${IMG_ORG}/${IMG_NAME}:${IMG_TAG}"
####################################
# Sanity checks
####################################
PROGRAMS := git docker python singularity tox $(CC)
.PHONY: $(PROGRAMS)
.SILENT: $(PROGRAMS)
docker:
docker info 1> /dev/null 2> /dev/null && \
if [ ! $$? -eq 0 ]; then \
echo "\n[ERROR] Could not communicate with docker daemon. You may need to run with sudo.\n"; \
exit 1; \
fi
python poetry singularity $(CC):
$@ --help &> /dev/null; \
if [ ! $$? -eq 0 ]; then \
echo "[ERROR] $@ does not seem to be on your path. Please install $@"; \
exit 1; \
fi
tox:
$@ -h &> /dev/null; \
if [ ! $$? -eq 0 ]; then \
echo "[ERROR] $@ does not seem to be on your path. Please pip install $@"; \
exit 1; \
fi
git:
$@ -h &> /dev/null; \
if [ ! $$? -eq 129 ]; then \
echo "[ERROR] $@ does not seem to be on your path. Please install $@"; \
exit 1; \
fi
####################################
# Docker
####################################
.PHONY: image shell tests
image: Dockerfile | docker
docker build -t $(IMG) -f $< .
tests: image | docker
docker run --rm $(IMG) dotfiles/./install.sh
shell: image | docker
docker run --rm -it $(IMG) bash