-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
74 lines (52 loc) · 1.44 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
TAG_NAME=node-api-boilerplate
VERSION=$(shell git rev-parse --short HEAD)
IMAGE_TAG=$(TAG_NAME):$(VERSION)
IMAGE_TAG_LATEST=$(TAG_NAME):latest
DOCKER_USERNAME=username-here
USER="$(shell id -u):$(shell id -g)"
COMPOSE_RUN=docker-compose run --rm --user=$(USER)
COMPOSE_EXEC=docker exec -it
start: build up logs
workdir:
$(COMPOSE_EXEC) api sh
npm-install:
$(COMPOSE_EXEC) api npm install
migrate-up:
$(COMPOSE_EXEC) api npm run migrate:up
migrate-down:
$(COMPOSE_EXEC) api npm run migrate:down
build:
docker-compose build
up:
docker-compose up
down:
docker-compose down
logs:
docker logs -f api
down-v:
docker-compose down -v
reset:
down-v
test:
lint:
$(COMPOSE_RUN) --no-deps --entrypoint='' api npm run lint
lint-fix:
$(COMPOSE_RUN) --no-deps --entrypoint='' api npm run lint:fix
docker-build:
docker build . -f prod.Dockerfile -t $(IMAGE_TAG)
docker-login:
cat docker_password.txt | docker login --username $(DOCKER_USERNAME) --password-stdin
docker-login-ci:
docker login --username $(DOCKER_USERNAME) --password $(DOCKER_PASSWORD)
docker-tag-latest:
docker tag $(IMAGE_TAG) $(IMAGE_TAG_LATEST)
docker-push:
docker push $(IMAGE_TAG)
docker-push-latest:
docker push $(IMAGE_TAG_LATEST)
docker-run-image:
docker run -it --rm $(IMAGE_TAG) sh
docker-release: docker-build docker-push
docker-release-latest: docker-release docker-tag-latest docker-push-latest
show_local_development_url:
node -r dotenv/config ./subdomain.js --full-url