-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathMakefile
31 lines (23 loc) · 1017 Bytes
/
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
.PHONY: help
VERSION ?= `grep 'version' mix.exs | sed -e 's/ //g' -e 's/version://' -e 's/[",]//g'`
IMAGE_NAME ?= distillery_example
PWD ?= `pwd`
help:
@echo "$(IMAGE_NAME):$(VERSION)"
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
init: ## Initialize the project from a clean state
mix local.rebar --force
mix local.hex --force
mix deps.get
compile: ## Build the application
mix do compile, phx.digest
clean: ## Clean up generated artifacts
mix clean
rebuild: clean release ## Rebuild the application
image: ## Mimic CodeBuild build
docker run --rm -e BUILD_DIR=/opt/app -v $(PWD):/opt/app -it centos:7 /opt/app/bin/build all
release: ## Build a release of the application with MIX_ENV=prod
MIX_ENV=prod mix do deps.get, compile
MIX_ENV=prod mix phx.digest
MIX_ENV=prod mix distillery.release
@cp _build/prod/rel/$(IMAGE_NAME)/releases/$(VERSION)/$(IMAGE_NAME).tar.gz $(IMAGE_NAME).tar.gz