-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (42 loc) · 1.11 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
CHALLENGE?=1
DOCKERFILE?="Dockerfile"
.DEFAULT: all
all: build
# Separate git repository and working tree into
# different directories, because git gets confused when
# working with nested repositories in a no-submodules fashion.
pack: repo/.git
mv repo tree
mkdir repo
mv tree repo
mv repo/tree/.git repo/git
.PHONY:pack
# Revert the packing operation
unpack: repo/git
mv repo/git repo/.git
mv repo/tree/* repo/
mv repo/tree/.* repo/ || true
rmdir repo/tree
.PHONY: unpack
# Create a new remote
remote:
git init --bare remote
# Clone a repo as user
clone-%: remote
echo "cloning as $*"
git clone remote $*
cat ../../users/$*.config >> $*/.git/config
.PHONY: clone-%
## Targets to work with docker images
build:
sudo docker build -t gitchallenge/challenge-$(CHALLENGE) -f $(DOCKERFILE) .
.PHONY: build
run: build
sudo docker run --rm -it gitchallenge/challenge-$(CHALLENGE)
.PHONY: run
run-vim: build
sudo docker run --rm -it -v $(HOME)/.vim:/root/.vim -v $(HOME)/.vimrc:/root/.vimrc gitchallenge/challenge-$(CHALLENGE)
.PHONY: run
push: build
sudo docker push gitchallenge/challenge-$(CHALLENGE)
.PHONY: push