-
Notifications
You must be signed in to change notification settings - Fork 74
/
Makefile.containers
59 lines (51 loc) · 1.74 KB
/
Makefile.containers
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
#!/usr/bin/make -f
ifndef CONTAINER_CLITOOL
ifeq ($(shell docker -v >/dev/null 2>&1 || echo FAIL),)
CONTAINER_CLITOOL = docker
else ifeq ($(shell podman -v >/dev/null 2>&1 || echo FAIL),)
CONTAINER_CLITOOL = podman
endif
endif
ifeq ($(CONTAINER_CLITOOL), docker)
CONTAINER_BUILDENV ?= DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain
ifeq ($(shell docker-compose -v >/dev/null 2>&1 || echo FAIL),)
CONTAINER_COMPOSE = docker-compose
else ifeq ($(shell docker compose -v >/dev/null 2>&1 || echo FAIL),)
CONTAINER_COMPOSE = docker compose
endif
else ifeq ($(CONTAINER_CLITOOL), podman)
ifeq ($(shell podman-compose -v >/dev/null 2>&1 || echo FAIL),)
CONTAINER_COMPOSE = podman-compose --podman-rm-args=--depend
endif
else ifdef CONTAINER_CLITOOL
CONTAINER_COMPOSE = $(error Invalid CONTAINER_CLITOOL: $(CONTAINER_CLITOOL) (supported values: docker, podman))
endif
ifdef CONTAINER_COMPOSE
CONTAINER_COMPOSETOOL = $(CONTAINER_COMPOSE)
ifeq ($(OS), linux)
CONTAINER_VOLUME_FLAGS = :z
else
CONTAINER_VOLUME_FLAGS =
endif
else
CONTAINER_COMPOSETOOL = $(error Neither docker-compose, docker compose or podman-compose were found)
endif
ifeq ($(OS_RELEASE), ubuntu)
CONTAINER_OS_TYPE = deb
else ifeq ($(OS_RELEASE), debian)
CONTAINER_OS_TYPE = deb
else ifeq (${OS_RELEASE}, alpine)
CONTAINER_OS_TYPE = apk
else
CONTAINER_OS_TYPE = rpm
endif
CONTAINER_REGISTRY ?= docker.io
ifeq ($(OS_RELEASE), suse)
CONTAINER_REGISTRY = registry.suse.com
endif
ifeq ($(OS_RELEASE), redhatenterprise)
CONTAINER_REGISTRY = registry.access.redhat.com
BASE_IMAGE = $(CONTAINER_REGISTRY)/ubi$(OS_VERSION)/ubi:latest
endif
CONTAINER_NGINX_IMAGE_REGISTRY ?= registry.nginx.com
CONTAINER_VARS = CONTAINER_CLITOOL CONTAINER_COMPOSE CONTAINER_BUILDENV CONTAINER_OS_TYPE CONTAINER_REGISTRY CONTAINER_NGINX_IMAGE_REGISTRY