forked from databacker/mysql-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (39 loc) · 1.28 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
.PHONY: build push test
TAG ?= $(shell git log -n 1 --pretty=format:"%H")
IMAGE ?= databack/mysql-backup
BUILDIMAGE ?= $(IMAGE):build
TARGET ?= $(IMAGE):$(TAG)
ARCH ?= linux/amd64,linux/arm64
build:
docker buildx build -t $(BUILDIMAGE) --platform $(ARCH) .
push: build
docker tag $(BUILDIMAGE) $(TARGET)
docker push $(TARGET)
test_dump:
cd test && DEBUG=$(DEBUG) ./test_dump.sh
test_cron:
cd test && ./test_cron.sh
test_source_target:
cd test && ./test_source_target.sh
test: test_dump test_cron test_source_target
.PHONY: clean-test-stop clean-test-remove clean-test
clean-test-stop:
@echo Kill Containers
$(eval IDS:=$(strip $(shell docker ps --filter label=mysqltest -q)))
@if [ -n "$(IDS)" ]; then docker kill $(IDS); fi
@echo
clean-test-remove:
@echo Remove Containers
$(eval IDS:=$(shell docker ps -a --filter label=mysqltest -q))
@if [ -n "$(IDS)" ]; then docker rm $(IDS); fi
@echo
@echo Remove Volumes
$(eval IDS:=$(shell docker volume ls --filter label=mysqltest -q))
@if [ -n "$(IDS)" ]; then docker volume rm $(IDS); fi
@echo
clean-test-network:
@echo Remove Networks
$(eval IDS:=$(shell docker network ls --filter label=mysqltest -q))
@if [ -n "$(IDS)" ]; then docker network rm $(IDS); fi
@echo
clean-test: clean-test-stop clean-test-remove clean-test-network