Skip to content

Commit e652e38

Browse files
committed
add docker-compose-dev.yml
1 parent cf4d804 commit e652e38

15 files changed

+106
-32
lines changed

client/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
22
npm-debug
3-
build
3+
.git

client/Dockerfile.dev

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:12-alpine
2+
3+
WORKDIR /app
4+
COPY . /app
5+
6+
RUN npm install --silent
7+
8+
EXPOSE 3000
9+
CMD ["npm","start"]

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"react-scripts": "3.4.1",
2020
"typescript": "^3.7.5"
2121
},
22-
"proxy": "http://localhost:5500",
22+
"proxy": "http://server:5500",
2323
"scripts": {
2424
"start": "react-scripts start",
2525
"build": "react-scripts build",

docker-compose-dev.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3'
2+
services:
3+
server:
4+
build:
5+
context: ./server
6+
dockerfile: Dockerfile.dev
7+
networks:
8+
- webapp
9+
ports:
10+
- 5500:5500
11+
env_file: ./server/.env
12+
volumes:
13+
- ./server/src:/app/src
14+
restart: always
15+
command: nodemon
16+
container_name: server
17+
client:
18+
build:
19+
context: ./client
20+
dockerfile: Dockerfile.dev
21+
env_file: ./client/.env
22+
volumes:
23+
- ./client/src:/app/src
24+
- ./client/public:/app/public
25+
networks:
26+
- webapp
27+
ports:
28+
- 8080:3000
29+
command: npm start
30+
links:
31+
- server
32+
stdin_open: true
33+
container_name: client
34+
35+
networks:
36+
webapp:
37+
driver: bridge

docker-compose.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
version: '3'
22
services:
33
server:
4-
build: ./server
4+
build:
5+
context: ./server
6+
dockerfile: Dockerfile
57
networks:
68
- webapp
79
container_name: server
810
client:
9-
build: ./client
11+
build:
12+
context: ./client
13+
dockerfile: Dockerfile
1014
networks:
1115
- webapp
1216
ports:
1317
- '80:80'
18+
links:
19+
- server
1420
container_name: client
1521

1622
networks:

server/.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
.git
33
npm-debug
4-
build

server/Dockerfile.dev

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:12-alpine
2+
3+
WORKDIR /app
4+
COPY . /app
5+
6+
RUN npm install -g nodemon --silent
7+
RUN npm install --silent
8+
9+
EXPOSE 5500
10+
11+
CMD ["nodemon"]

server/config/nodemon.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

server/config/tsconfig.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
"baseUrl": "./",
44
"emitDecoratorMetadata": true,
55
"esModuleInterop": true,
6-
"experimentalDecorators": true,
76
"allowSyntheticDefaultImports": true,
7+
"experimentalDecorators": true,
88
"importHelpers": true,
99
"module": "commonjs",
10-
"outDir": "../build",
1110
"removeComments": true,
1211
"sourceMap": true,
1312
"strict": true,
1413
"target": "es5",
1514
"moduleResolution": "node",
1615
"types": ["node"],
1716
"typeRoots": ["node_modules/@types"]
18-
},
19-
"exclude": ["."]
17+
}
2018
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"rootDir": "../",
4+
"rootDir": "../src",
55
"outDir": "../build",
66
"removeComments": true
77
},
8-
"include": ["../**/*"],
8+
"include": ["../src/**/*"],
99
"exclude": ["."]
1010
}

0 commit comments

Comments
 (0)