File tree Expand file tree Collapse file tree 8 files changed +83
-2
lines changed
src/apps/mooc_backend/config Expand file tree Collapse file tree 8 files changed +83
-2
lines changed Original file line number Diff line number Diff line change 1+ .dockerignore
2+ .git
3+ docker-compose.yml
4+ Dockerfile
5+ node_modules
6+ dist
7+ data
8+ logs
Original file line number Diff line number Diff line change 33.tmp
44logs /
55src /Contexts /Mooc /Courses /infrastructure /persistence /courses. *
6+ data
Original file line number Diff line number Diff line change 1+ FROM node:12.16.3-slim
2+
3+ WORKDIR /code
4+
5+ COPY package.json package-lock.json ./
6+ RUN npm install
Original file line number Diff line number Diff line change 1+ .PHONY = default deps build test start clean start-database
2+
3+ IMAGE_NAME := codelytv/typescript-ddd-skeleton
4+ SERVICE_NAME := app
5+
6+ # Test if the dependencies we need to run this Makefile are installed
7+ DOCKER := $(shell command -v docker)
8+ DOCKER_COMPOSE := $(shell command -v docker-compose)
9+ deps :
10+ ifndef DOCKER
11+ @echo "Docker is not available. Please install docker"
12+ @exit 1
13+ endif
14+ ifndef DOCKER_COMPOSE
15+ @echo "docker-compose is not available. Please install docker-compose"
16+ @exit 1
17+ endif
18+
19+ default : build
20+
21+ # Build image
22+ build :
23+ docker build -t $(IMAGE_NAME ) :dev .
24+
25+ # Run tests
26+ test : build
27+ docker-compose run --rm $(SERVICE_NAME ) bash -c ' npm run build && npm run test'
28+
29+ # Start the application
30+ start : build
31+ docker-compose up $(SERVICE_NAME ) && docker-compose down
32+
33+ # Clean containers
34+ clean :
35+ docker-compose down --rmi local --volumes --remove-orphans
36+
37+ # Start mongodb container in background
38+ start_database :
39+ docker-compose up -d mongo
Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+
3+ services :
4+ app :
5+ build : .
6+ command : bash -c "npm run build && npm run start"
7+ ports :
8+ - 3000:3000
9+ environment :
10+ - MONGO_URL=mongodb://mongo:27017/dev
11+ depends_on :
12+ - mongo
13+ volumes :
14+ - .:/code:delegated
15+ - node_modules:/code/node_modules:delegated
16+
17+ mongo :
18+ image : mongo:3.4.6
19+ volumes :
20+ - ./data/mongo:/data/db:delegated
21+ ports :
22+ - 27017:27017
23+
24+ volumes :
25+ node_modules :
Original file line number Diff line number Diff line change 1818 "start" : " NODE_ENV=production node dist/src/apps/mooc_backend/server" ,
1919 "build" : " npm run build:clean && npm run build:tsc && npm run build:di" ,
2020 "build:tsc" : " tsc -p tsconfig.prod.json" ,
21- "build:di" : " copy 'src/**/*.yaml' dist/src" ,
21+ "build:di" : " copy 'src/**/*.{json, yaml} ' dist/src" ,
2222 "build:clean" : " rm -r dist; exit 0"
2323 },
2424 "dependencies" : {
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ const convictConfig = convict({
1111 url : {
1212 doc : 'The Mongo connection URL' ,
1313 format : String ,
14- env : 'MONGO_URL'
14+ env : 'MONGO_URL' ,
15+ default : 'mongodb://mongo:27017/dev'
1516 }
1617 }
1718} ) ;
Original file line number Diff line number Diff line change 1+ {}
You can’t perform that action at this time.
0 commit comments