Skip to content

Commit ba63a67

Browse files
committed
Makefile: Add support to start backoffice frontend application
1 parent 187f631 commit ba63a67

3 files changed

Lines changed: 32 additions & 13 deletions

File tree

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
.PHONY = default deps build test start clean start-database
1+
.PHONY = default deps build test start-mooc-backend clean start-database start-backoffice-frontend
22

33
IMAGE_NAME := codelytv/typescript-ddd-skeleton
44
SERVICE_NAME := app
5+
MOOC_APP_NAME := mooc
6+
BACKOFFICE_APP_NAME := backoffice
57

68
# Test if the dependencies we need to run this Makefile are installed
79
DOCKER := $(shell command -v docker)
@@ -26,9 +28,13 @@ build:
2628
test: build
2729
docker-compose run --rm $(SERVICE_NAME) bash -c 'npm run build && npm run test'
2830

29-
# Start the application
30-
start: build
31-
docker-compose up $(SERVICE_NAME) && docker-compose down
31+
# Start mooc backend app
32+
start-mooc-backend: build
33+
docker-compose up $(MOOC_APP_NAME)-backend && docker-compose down
34+
35+
# Start backoffice frontend app
36+
start-backoffice-frontend: build
37+
docker-compose up $(BACKOFFICE_APP_NAME)-frontend && docker-compose down
3238

3339
# Clean containers
3440
clean:

docker-compose.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
version: '3.8'
22

3+
x-app-service: &default-app
4+
build: .
5+
command: ''
6+
environment:
7+
- MONGO_URL=mongodb://mongo:27017/dev
8+
depends_on:
9+
- mongo
10+
volumes:
11+
- .:/code
12+
- node_modules:/code/node_modules
13+
314
services:
415
app:
5-
build: .
16+
<<: *default-app
17+
18+
mooc-backend:
19+
<<: *default-app
620
command: bash -c "npm run build && npm run start"
721
ports:
822
- 3000:3000
9-
environment:
10-
- MONGO_URL=mongodb://mongo:27017/dev
11-
depends_on:
12-
- mongo
13-
volumes:
14-
- .:/code
15-
- node_modules:/code/node_modules
23+
24+
backoffice-frontend:
25+
<<: *default-app
26+
command: bash -c "npm run build && npm run start:backoffice:frontend"
27+
ports:
28+
- 8032:8032
1629

1730
mongo:
1831
image: mongo:3.4.6

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"start:backoffice:frontend": "NODE_ENV=production node dist/src/apps/backoffice/frontend/server",
2121
"build": "npm run build:clean && npm run build:tsc && npm run build:di",
2222
"build:tsc": "tsc -p tsconfig.prod.json",
23-
"build:di": "copy 'src/**/*.{json,yaml}' dist/src",
23+
"build:di": "copy 'src/**/*.{json,yaml,html,png}' dist/src",
2424
"build:clean": "rm -r dist; exit 0"
2525
},
2626
"dependencies": {

0 commit comments

Comments
 (0)