forked from janeczku/docker-alpine-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (32 loc) · 1.38 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
# Makefile for the Docker image janeczku/alpine-kubernetes
# MAINTAINER: Jan Broer <[email protected]>
.PHONY: all git-tag build release test build-test
IMAGE = janeczku/alpine-kubernetes
TAG = 3.2
ifdef CIRCLE_BUILD_NUM
BUILD_NUM = ${CIRCLE_BUILD_NUM}
else
BUILD_NUM = $(shell git rev-parse --short HEAD)
endif
all:
@echo "Available targets:"
@echo " * build - build image $(IMAGE):$(TAG)-$(BUILD_NUM)"
@echo " * test - run integration tests in test-image"
@echo " * release - git tag build and push to Docker Hub"
@echo " * git-tag - git tag build"
build:
docker build -t $(IMAGE):$(TAG) .
docker tag -f $(IMAGE):$(TAG) $(IMAGE):$(TAG)-$(BUILD_NUM)
docker tag -f $(IMAGE):$(TAG) $(IMAGE):latest
build-test:
docker build -t test-image:$(TAG)-$(BUILD_NUM) -f test/Dockerfile .
test: build-test
docker run -e S6_LOGGING=1 --dns=8.8.4.4 --dns-search=10.0.0.1.xip.io test-image:$(TAG)-$(BUILD_NUM) /bin/sh -c "sleep 5; /usr/local/bin/bats /app/bats-tests"
docker run -e S6_LOGGING=1 --dns 8.8.4.4 --dns 8.8.8.8 --dns-search google.com --dns-search video.google.com test-image:$(TAG)-$(BUILD_NUM) /bin/sh -c "sleep 5; /usr/local/bin/bats /app/bats-tests-more"
release: git-tag
docker push $(IMAGE):$(TAG)
docker push $(IMAGE):$(TAG)-$(BUILD_NUM)
docker push $(IMAGE):latest
git-tag:
git tag -f -a $(TAG)-$(BUILD_NUM) -m "Release build for $(TAG)-$(BUILD_NUM)"
git push -f --tags