This repository has been archived by the owner on Mar 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker.version.mk
177 lines (128 loc) · 4.35 KB
/
docker.version.mk
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
### BASE_IMAGE #################################################################
BASE_IMAGE_NAME ?= $(DOCKER_PROJECT)/baseimage-centos
BASE_IMAGE_TAG ?= 7
### DOCKER_IMAGE ###############################################################
KIBANA_TAG ?= $(KIBANA_VERSION)
DOCKER_PROJECT ?= sicz
DOCKER_PROJECT_DESC ?= An analytics and search dashboard for Elasticsearch
DOCKER_PROJECT_URL ?= https://www.elastic.co/products/kibana
DOCKER_NAME ?= kibana
DOCKER_IMAGE_TAG ?= $(KIBANA_TAG)
### BUILD ######################################################################
# Docker image build variables
BUILD_VARS += KIBANA_VERSION
### EXECUTOR ###################################################################
# Use the Docker Compose executor
DOCKER_EXECUTOR ?= compose
# Variables used in the Docker Compose file
COMPOSE_VARS += ELASTICSEARCH_IMAGE \
SERVER_CRT_HOST \
SIMPLE_CA_IMAGE
# Certificate subject aletrnative names
SERVER_CRT_HOST += $(SERVICE_NAME).local
### ELASTICSEARCH ##############################################################
# Docker image dependencies
DOCKER_IMAGE_DEPENDENCIES += $(ELASTICSEARCH_IMAGE)
# Elasticsearch image
ELASTICSEARCH_IMAGE_NAME ?= $(DOCKER_PROJECT)/elasticsearch
ELASTICSEARCH_IMAGE_TAG ?= $(KIBANA_TAG)
ELASTICSEARCH_IMAGE ?= $(ELASTICSEARCH_IMAGE_NAME):$(ELASTICSEARCH_IMAGE_TAG)
### SIMPLE_CA ##################################################################
# Docker image dependencies
DOCKER_IMAGE_DEPENDENCIES += $(SIMPLE_CA_IMAGE)
# Simple CA image
SIMPLE_CA_IMAGE_NAME ?= $(DOCKER_PROJECT)/simple-ca
SIMPLE_CA_IMAGE_TAG ?= latest
SIMPLE_CA_IMAGE ?= $(SIMPLE_CA_IMAGE_NAME):$(SIMPLE_CA_IMAGE_TAG)
### MAKE_VARS ##################################################################
# Display the make variables
MAKE_VARS ?= GITHUB_MAKE_VARS \
CONFIG_MAKE_VARS \
BASE_IMAGE_MAKE_VARS \
DOCKER_IMAGE_MAKE_VARS \
BUILD_MAKE_VARS \
EXECUTOR_MAKE_VARS \
SHELL_MAKE_VARS \
DOCKER_REGISTRY_MAKE_VARS
define CONFIG_MAKE_VARS
KIBANA_VERSION: $(KIBANA_VERSION)
KIBANA_TAG: $(KIBANA_TAG)
XPACK_EDITION: $(XPACK_EDITION)
ELASTICSEARCH_IMAGE_NAME: $(ELASTICSEARCH_IMAGE_NAME)
ELASTICSEARCH_IMAGE_TAG: $(ELASTICSEARCH_IMAGE_TAG)
ELASTICSEARCH_IMAGE: $(ELASTICSEARCH_IMAGE)
SIMPLE_CA_IMAGE_NAME: $(SIMPLE_CA_IMAGE_NAME)
SIMPLE_CA_IMAGE_TAG: $(SIMPLE_CA_IMAGE_TAG)
SIMPLE_CA_IMAGE: $(SIMPLE_CA_IMAGE)
SERVER_CRT_HOST: $(SERVER_CRT_HOST)
endef
export CONFIG_MAKE_VARS
### MAKE_TARGETS ###############################################################
# Build a new image and run the tests
.PHONY: all
all: clean build start wait logs test
# Build a new image and run the tests
.PHONY: ci
ci: all
@$(MAKE) clean
### BUILD_TARGETS ##############################################################
# Build a new image with using the Docker layer caching
.PHONY: build
build: docker-build
# Build a new image without using the Docker layer caching
.PHONY: rebuild
rebuild: docker-rebuild
### EXECUTOR_TARGETS ###########################################################
# Display the configuration file
.PHONY: config-file
config-file: display-config-file
# Display the make variables
.PHONY: vars
vars: display-makevars
# Remove the containers and then run them fresh
.PHONY: run up
run up: docker-up
# Create the containers
.PHONY: create
create: docker-create
# Start the containers
.PHONY: start
start: create docker-start
# Wait for the start of the containers
.PHONY: wait
wait: start docker-wait
# Display running containers
.PHONY: ps
ps: docker-ps
# Display the container logs
.PHONY: logs
logs: docker-logs
# Follow the container logs
.PHONY: logs-tail tail
logs-tail tail: docker-logs-tail
# Run shell in the container
.PHONY: shell sh
shell sh: start docker-shell
# Run the tests
.PHONY: test
test: start docker-test
# Run the shell in the test container
.PHONY: test-shell tsh
test-shell tsh:
@$(MAKE) test TEST_CMD=/bin/bash
# Stop the containers
.PHONY: stop
stop: docker-stop
# Restart the containers
.PHONY: restart
restart: stop start
# Remove the containers
.PHONY: down rm
down rm: docker-rm
# Remove all containers and work files
.PHONY: clean
clean: docker-clean
### MK_DOCKER_IMAGE ############################################################
MK_DIR ?= $(PROJECT_DIR)/../Mk
include $(MK_DIR)/docker.image.mk
################################################################################