This repository has been archived by the owner on May 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (69 loc) · 2.09 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Load the environment variables
ifdef ENV
export ENV_FILE = .env.$(ENV)
else
export ENV_FILE = .env
endif
# Include the envionment variables in this Makefile
include $(ENV_FILE)
# Export these variables for docker-compose usage
export CONTAINER_NAME = serverless-react/devbox
export NODE_CONTAINER = \
--interactive \
--rm \
--tty \
--volume $(shell pwd):/var/task \
--workdir /var/task \
$(CONTAINER_NAME)
build-server:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) yarn run build:server
build-static:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) yarn run build:static
deploy-master:
@make stop-docker
@docker run --env-file .env.master $(NODE_CONTAINER) yarn run tsc
@docker run --env-file .env.master $(NODE_CONTAINER) yarn run tslint
@docker run \
--env-file .env.master \
--env "BABEL_ENV=production" \
--env "NODE_ENV=production" \
$(NODE_CONTAINER) yarn run build:static
@docker run \
--env-file .env.master \
--env "BABEL_ENV=serverless" \
--env "NODE_ENV=production" \
$(NODE_CONTAINER) serverless deploy --stage master
@docker run \
--env-file .env.master \
$(NODE_CONTAINER) serverless client deploy --no-confirm --stage master
check:
@make tsc
@make tslint
dev:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) /bin/bash
devbox:
@docker build --no-cache --tag $(CONTAINER_NAME) .
install:
@docker run $(NODE_CONTAINER) yarn install
profile:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) yarn run profile
start:
@docker-compose -f docker-compose.yml down --remove-orphans --volumes
@docker-compose -f docker-compose.yml up -d --no-recreate --remove-orphans
start-hard:
rm -rf node_modules
rm -f yarn.lock
make devbox
make install
make start
stop:
@docker-compose -f docker-compose.yml down --remove-orphans --volumes
stop-docker:
@docker ps -aq | xargs docker stop
@docker ps -aq | xargs docker rm
tsc:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) yarn run tsc
tslint:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) yarn run tslint
tslint-fix:
@docker run --env-file $(ENV_FILE) $(NODE_CONTAINER) yarn run tslint:fix