forked from ellie-app/ellie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (41 loc) · 1.34 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
40
41
42
43
44
45
46
47
48
49
.PHONY: help
VERSION ?= `grep 'version' mix.exs | sed -e 's/ //g' -e 's/version://' -e 's/[",]//g'`
IMAGE_NAME ?= ellie
PWD ?= `pwd`
BUILD ?= `git rev-parse --short HEAD`
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}'
compile: ## Build the application
mix do deps.get, compile
mix generate_schema
cd assets && \
npm install && \
npm run graphql && \
npm run build
mix phx.digest
clean: ## Clean up generated artifacts
@rm -rf \
_build \
assets/node_modules \
assets/elm-stuff \
priv/graphql \
priv/bin \
mix clean --deps
image: ## Mimic CodeBuild build
$(MAKE) clean
docker run --rm -e BUILD_DIR=/app -v $(PWD):/app -it centos:7 /app/scripts/build all
release: ## Build a release of the application with MIX_ENV=prod
MIX_ENV=prod mix do deps.get, compile
mix generate_schema
cd assets && \
NODE_ENV=production npm install && \
NODE_ENV=production npm run graphql && \
NODE_ENV=production npm run build
MIX_ENV=prod mix phx.digest
MIX_ENV=prod mix release --verbose --env=prod
@cp _build/prod/rel/$(IMAGE_NAME)/releases/$(VERSION)/$(IMAGE_NAME).tar.gz $(IMAGE_NAME).tar.gz
bootstrap: ## Setup the app dev
scripts/bootstrap
serve: ## Run the app locally for dev
scripts/server