-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
45 lines (36 loc) · 1.06 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
.PHONY = default deps build test start-financial
# Shell to use for running scripts
SHELL := $(shell which bash)
IMAGE_NAME := alesquare/typescript-ddd-skeleton
SERVICE_NAME := app
FINANCIAL_APP_NAME := financial
# Test if the dependencies we need to run this Makefile are installed
DOCKER := $(shell command -v docker)
DOCKER_COMPOSE := $(shell command -v docker-compose)
deps:
ifndef DOCKER
@echo "Docker is not available. Please install docker"
@exit 1
endif
ifndef DOCKER_COMPOSE
@echo "docker-compose is not available. Please install docker-compose"
@exit 1
endif
default: build
# Build image
build:
docker build -t $(IMAGE_NAME):dev .
# Run tests
test: build
docker-compose run --rm $(SERVICE_NAME) bash -c 'npm run build && npm run test'
# Start financial app
start-financial: build
docker-compose up $(FINANCIAL_APP_NAME)
# Clean containers
clean:
docker-compose down --rmi local --volumes --remove-orphans
# Start databases containers in background
start_database:
docker-compose up -d mongo elasticsearch rabbitmq
clean-files:
sudo rm -Rf dist data logs