-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
69 lines (49 loc) · 1.48 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
67
68
69
-include env_make
REDIS_VER ?= 7.4.1
TAG ?= $(shell echo "${REDIS_VER}" | grep -oE '^[0-9]+\.[0-9]+')
REPO = wodby/redis
NAME = redis-$(REDIS_VER)
ifneq ($(STABILITY_TAG),)
ifneq ($(TAG),latest)
override TAG := $(TAG)-$(STABILITY_TAG)
endif
endif
PLATFORM ?= linux/amd64
.PHONY: build buildx-build buildx-build-amd64 buildx-push test push shell run start stop logs clean release
default: build
build:
docker build -t $(REPO):$(TAG) \
--build-arg REDIS_VER=$(REDIS_VER) \
./
# --load doesn't work with multiple platforms https://github.com/docker/buildx/issues/59
# we need to save cache to run tests first.
buildx-build-amd64:
docker buildx build --platform linux/amd64 -t $(REPO):$(TAG) \
--build-arg REDIS_VER=$(REDIS_VER) \
--load \
./
buildx-build:
docker buildx build --platform $(PLATFORM) -t $(REPO):$(TAG) \
--build-arg REDIS_VER=$(REDIS_VER) \
./
buildx-push:
docker buildx build --platform $(PLATFORM) --push -t $(REPO):$(TAG) \
--build-arg REDIS_VER=$(REDIS_VER) \
./
test:
cd ./tests && IMAGE=$(REPO):$(TAG) NAME=$(NAME) ./run.sh
push:
docker push $(REPO):$(TAG)
shell:
docker run --rm --name $(NAME) -i -t $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) /bin/bash
run:
docker run --rm --name $(NAME) -e DEBUG=1 $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) $(CMD)
start:
docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG)
stop:
docker stop $(NAME)
logs:
docker logs $(NAME)
clean:
-docker rm -f $(NAME)
release: build push