forked from jmtd/debian-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (29 loc) · 942 Bytes
/
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
#!/usr/bin/make
# USAGE: 'sudo make' to build a jessie image (jmtd/debian:jessie).
# Define variables on the make command line to change behaviour
# e.g.
# sudo make release=wheezy arch=i386 tag=wheezy-i386
# variables that can be overridden:
release ?= jessie
prefix ?= jmtd
arch ?= amd64
mirror ?= http://httpredir.debian.org/debian/
tag ?= $(release)-$(arch)
build: $(tag)/root.tar $(tag)/Dockerfile
docker build -t $(prefix)/debian:$(tag) $(tag)
rev=$(shell git rev-parse --verify HEAD)
$(tag)/Dockerfile: Dockerfile.in $(tag)
sed 's/SUBSTITUTION_FAILED/$(rev)/' $< >$@
$(tag):
mkdir $@
$(tag)/root.tar: roots/$(tag) $(tag)
cd roots/$(tag) && tar cf ../../$(tag)/root.tar ./
roots/$(tag):
mkdir -p $@ \
&& debootstrap --arch $(arch) $(release) $@ $(mirror) \
&& chroot $@ apt-get clean
clean:
rm -f $(tag)/root.tar $(tag)/Dockerfile
rm -r roots/$(tag)
test -d $(tag) && rmdir $(tag)
.PHONY: clean build