-
Notifications
You must be signed in to change notification settings - Fork 74
/
Makefile.docker
66 lines (53 loc) · 1.93 KB
/
Makefile.docker
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
UID=$(shell id -u)
GID=$(shell id -g)
DOCKER_VERSION := $(shell docker --version 2>/dev/null)
ifndef DOCKER_VERSION
$(error "command docker is not available, please install Docker")
endif
# The "new" version integrates compose in the docker command.
# It also fixes a bug with stopping log output when the "--follow" option is set
COMPOSE_COMMAND=docker compose
DOCKER_COMPOSE_NEW := $(shell docker compose version 2>/dev/null)
ifndef DOCKER_COMPOSE_NEW
DOCKER_COMPOSE_OLD := $(shell docker-compose --version 2>/dev/null)
ifdef DOCKER_COMPOSE_OLD
COMPOSE_COMMAND = docker-compose
else
$(error "docker compose is not available, please install it")
endif
endif
hoot.env:
cp hoot.env.example hoot.env
.env: hoot-ui-2x/README.md
cp .env_versions .env
mkdir -p bin lib .ccache
echo "HOOT_UID=$(UID)" >> .env
echo "HOOT_GID=$(GID)" >> .env
echo "HOOT_USER=hoot" >> .env
echo "HOOT_GROUP=hoot" >> .env
echo "HOOT_HOME=/var/lib/hootenanny" >> .env
conf/database/DatabaseConfigLocal.sh:
touch conf/database/DatabaseConfigLocal.sh
chmod +x conf/database/DatabaseConfigLocal.sh
echo "#!/bin/bash;" >> conf/database/DatabaseConfigLocal.sh
echo "set -euo pipefail;" >> conf/database/DatabaseConfigLocal.sh
echo "export DB_HOST=postgres" >> conf/database/DatabaseConfigLocal.sh
echo "export DB_HOST_OSMAPI=postgres" >> conf/database/DatabaseConfigLocal.sh
hoot-ui-2x/README.md:
git submodule update --init
build: .env hoot.env conf/database/DatabaseConfigLocal.sh hoot-ui-2x/README.md
DOCKER_BUILDKIT=1 $(COMPOSE_COMMAND) build --no-cache
up: .env hoot.env conf/database/DatabaseConfigLocal.sh hoot-ui-2x/README.md
DOCKER_BUILDKIT=1 $(COMPOSE_COMMAND) up -d
down: .env hoot.env
DOCKER_BUILDKIT=1 $(COMPOSE_COMMAND) down
distclean: .env hoot.env
DOCKER_BUILDKIT=1 $(COMPOSE_COMMAND) down --volumes --rmi all
rm -fr .ccache lib bin \
.env hoot.env hoot-ui-2x/node_modules \
conf/database/DatabaseConfigLocal.sh
PHONY: \
build \
distclean \
down \
up