-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
37 lines (28 loc) · 1.21 KB
/
installer.sh
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
# pass no arguments
# pass one arguments
# pass many arguments
# --dry-run
# --remove <package>
# --install | --add <package>
NAME = phusion/baseimage
VERSION = 0.9.16
.PHONY: all build test tag_latest release ssh
all: build
build:
docker build -t $(NAME):$(VERSION) --rm image
test:
env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh
tag_latest:
docker tag -f $(NAME):$(VERSION) $(NAME):latest
release: test tag_latest
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi
@if ! head -n 1 Changelog.md | grep -q 'release date'; then echo 'Please note the release date in Changelog.md.' && false; fi
docker push $(NAME)
@echo "*** Don't forget to create a tag. git tag rel-$(VERSION) && git push origin rel-$(VERSION)"
ssh:
chmod 600 image/insecure_key
@ID=$$(docker ps | grep -F "$(NAME):$(VERSION)" | awk '{ print $$1 }') && \
if test "$$ID" = ""; then echo "Container is not running."; exit 1; fi && \
IP=$$(docker inspect $$ID | grep IPAddr | sed 's/.*: "//; s/".*//') && \
echo "SSHing into $$IP" && \
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i image/insecure_key root@$$IP