-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (54 loc) · 1.69 KB
/
Makefile
File metadata and controls
58 lines (54 loc) · 1.69 KB
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
.DEFAULT_GOAL := build
export IMAGE=authentication-api
ifdef GIT_COMMIT
export IMAGE_NAME=${IMAGE}:${GIT_COMMIT}
else
export IMAGE_NAME=${IMAGE}
endif
# $(shell echo IMAGE_NAME=${IMAGE_NAME} > .env)
help:
@echo
@echo
@echo " make - compile & build main image(s)"
@echo
@echo " make up - creates the container(s)"
@echo
@echo " make build-dev - compile, build image(s) & run container(s) in development mode"
@echo
@echo " make up-dev - run container(s) in development mode"
@echo
@echo " make test - creates container(s), run tests, then removes container(s)"
@echo
@echo " make clean - clean all build artifacts, docker container(s), and target volumes"
@echo
@echo " make down - removes the container(s)"
@echo
@echo
clean:
- sudo docker-compose -f docker/dev.yml down
- sudo rm -rf node_modules
npm-install:
npm install
npm run build
# npm prune --production
build: clean
@echo "Compiling source..."
sudo docker-compose -f docker/build.yml run --rm build make npm-install
@echo "Building image..."
sudo docker build -t $(IMAGE_NAME) .
build-deps:
sudo docker build -f docker/postgres/Dockerfile -t $(IMAGE_NAME)-pgdb1 ./
sudo docker build -f docker/redis/Dockerfile -t $(IMAGE_NAME)-redisdb1 ./
sudo docker build -f docker/swagger-ui/Dockerfile -t $(IMAGE_NAME)-swagger-ui1 ./
build-dev: build build-deps
sudo docker-compose -f docker/dev.yml up -d app
up-dev: down
sudo docker-compose -f docker/dev.yml up -d
up: down
sudo docker-compose -f docker/up.yml up -d
down:
sudo docker-compose -f docker/dev.yml down --remove-orphans
test: down
sudo docker-compose -f docker/test.yml run --rm test-app
sudo docker-compose -f docker/test.yml down --remove-orphans
.PHONY: test