-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
39 lines (30 loc) · 1.32 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
# -------------------------------------------
# Environment variables
# -------------------------------------------
APP_NAME = ido_keido
APP_VERSION ?= 0.0.1
PORT = 4004
VOLUME = `pwd`/data:/opt/app/data
COUNTRY_DB_KEY ?= ""
CITY_DB_KEY ?= ""
# -------------------------------------------
# Global commands
# -------------------------------------------
.DEFAULT_GOAL := help
help: ## [GLOBAL] Print this help
@awk -F ':|##' '/^[^\t].+?:.*?##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF }' $(MAKEFILE_LIST)
# -------------------------------------------
# Docker commands
# -------------------------------------------
docker-build: ## [DOCKER] Build the Docker image
docker build --build-arg MIX_ENV=prod --build-arg APP_NAME=$(APP_NAME) --build-arg APP_VERSION=$(APP_VERSION) -t $(APP_NAME):latest .
docker-run: ## [DOCKER] Run the API server locally
docker run -e PORT=$(PORT) -v $(VOLUME) -p $(PORT):$(PORT) --rm -it $(APP_NAME):latest
docker-iex: ## [DOCKER] Run IEx (Elixir's Interactive Shell)
docker run -e PORT=$(PORT) -v $(VOLUME) --rm -it $(APP_NAME):latest bin/ido_keido console
# ---------------------------------------------
# -- Database commands
# ---------------------------------------------
#
download-databases: ## [DATABASE] Download geolocation databases
./scripts/geoip_download.sh $(COUNTRY_DB_KEY) $(CITY_DB_KEY)