-
Notifications
You must be signed in to change notification settings - Fork 81
/
Makefile.containers
35 lines (31 loc) · 1.05 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
#!/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
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 nor podman-compose found)
endif
CONTAINER_VARS = CONTAINER_CLITOOL CONTAINER_COMPOSE CONTAINER_BUILDENV