File tree Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Original file line number Diff line number Diff line change 1+ # services:
2+ # nest-app:
3+ # build:
4+ # context: ./
5+ # dockerfile: ./Dockerfile
6+ # depends_on:
7+ # - mysql-container
8+ # - redis-container
9+ # ports:
10+ # - '3000:3000'
11+ # mysql-container:
12+ # image: mysql
13+ # ports:
14+ # - '3306:3306'
15+ # volumes:
16+ # - /Users/guang/mysql-data:/var/lib/mysql
17+ # redis-container:
18+ # image: redis
19+ # ports:
20+ # - '6379:6379'
21+ # volumes:
22+ # - /Users/guang/aaa:/data
23+ version : ' 3.8'
124services :
225 nest-app :
326 build :
@@ -8,15 +31,20 @@ services:
831 - redis-container
932 ports :
1033 - ' 3000:3000'
34+ networks :
35+ - common-network
1136 mysql-container :
1237 image : mysql
13- ports :
14- - ' 3306:3306'
1538 volumes :
1639 - /Users/guang/mysql-data:/var/lib/mysql
40+ networks :
41+ - common-network
1742 redis-container :
1843 image : redis
19- ports :
20- - ' 6379:6379'
2144 volumes :
2245 - /Users/guang/aaa:/data
46+ networks :
47+ - common-network
48+ networks :
49+ common-network :
50+ driver : bridge
Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ import { AppService } from './app.service';
99 imports : [
1010 TypeOrmModule . forRoot ( {
1111 type : "mysql" ,
12- host : "localhost" ,
12+ // host: "localhost",
13+ // host: '192.168.1.6',
14+ host : "mysql-container" ,
1315 port : 3306 ,
1416 username : "root" ,
1517 password : "guang" ,
@@ -31,7 +33,9 @@ import { AppService } from './app.service';
3133 async useFactory ( ) {
3234 const client = createClient ( {
3335 socket : {
34- host : 'localhost' ,
36+ // host: 'localhost',
37+ // host: '192.168.1.6',
38+ host : 'redis-container' ,
3539 port : 6379
3640 }
3741 } ) ;
@@ -42,3 +46,4 @@ import { AppService } from './app.service';
4246 ]
4347} )
4448export class AppModule { }
49+
You can’t perform that action at this time.
0 commit comments