-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
66 lines (57 loc) · 1.19 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
61
62
63
64
65
66
NAME=dockstack
.PHONY: all bash build clean lint run stop test
all: build run test
stop:
docker ps \
--quiet \
--filter ancestor=$(NAME) \
| xargs \
--no-run-if-empty \
docker stop
clean: stop
docker system prune \
--force
lint:
docker run \
--tty \
--interactive \
--rm \
--volume "$(PWD)/Dockerfile:/Dockerfile:ro" \
redcoolbeans/dockerlint
build:
docker build \
--tag $(NAME) \
--build-arg BUILD_DATE=`date --utc +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VERSION="test" \
.
# Beware: This container runs in privileged mode!
# - https://github.com/moby/moby/issues/24387#issuecomment-249195810
# TODO: Specify least needed rights and mounts
# - https://github.com/solita/docker-systemd
run:
docker run \
--name $(NAME) \
--privileged \
--detach \
$(NAME)
docker exec \
--tty \
--interactive \
$(NAME) \
bash -c "su stack -c '/devstack/stack.sh'"
test:
docker exec \
--tty \
--interactive \
$(NAME) \
bash -c "su stack -c '\
source /devstack/openrc admin admin && \
zun run --name test cirros ping -c 4 8.8.8.8 \
'"
bash:
docker exec \
--tty \
--interactive \
$(NAME) \
bash