-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
62 lines (43 loc) · 1.43 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
# Load test variables
-include tests/env_make
# Allow using a different docker binary
DOCKER ?= docker
# Force BuildKit mode for builds
# See https://docs.docker.com/buildx/working-with-buildx/
DOCKER_BUILDKIT=1
IMAGE ?= docksal/nginx
VERSION ?= 1.21
UPSTREAM_IMAGE ?= nginx:1.21-alpine
BUILD_IMAGE_TAG ?= $(IMAGE):$(VERSION)-build
NAME = docksal-nginx-$(VERSION)
# Make it possible to pass arguments to Makefile from command line
# https://stackoverflow.com/a/6273809/1826109
ARGS = $(filter-out $@,$(MAKECMDGOALS))
.EXPORT_ALL_VARIABLES:
.PHONY: build test push shell run start stop logs clean
default: build
build:
$(DOCKER) build -t $(BUILD_IMAGE_TAG) --build-arg UPSTREAM_IMAGE=$(UPSTREAM_IMAGE) --build-arg VERSION=$(VERSION) .
test:
IMAGE=$(BUILD_IMAGE_TAG) NAME=$(NAME) VERSION=$(VERSION) ./tests/test.bats
push:
$(DOCKER) push $(BUILD_IMAGE_TAG)
shell: clean
$(DOCKER) run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) /bin/bash
run: clean
$(DOCKER) run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG)
start: clean
$(DOCKER) run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG)
stop:
$(DOCKER) stop $(NAME)
logs:
$(DOCKER) logs $(NAME)
logs-follow:
$(DOCKER) logs -f $(NAME)
debug: build start logs-follow
clean:
$(DOCKER) rm -vf $(NAME) || true
# Make it possible to pass arguments to Makefile from command line
# https://stackoverflow.com/a/6273809/1826109
%:
@: