-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
76 lines (72 loc) · 1.87 KB
/
docker-compose.yml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
services:
nestjs-graphql-api:
container_name: nestjs-graphql-api
image: nestjs-graphql-api
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
target: development # Only will build development stage from our dockerfile
volumes:
- ./:/usr/src/app
ports:
- ${PORT}:${PORT}
networks:
- nestjs-graphql-intranet
env_file:
- .env # Available inside container not in compose file
environment:
- DB_HOST=nestjs-graphql-mysql
- REDIS_HOST=nestjs-graphql-redis
depends_on:
nestjs-graphql-mysql:
condition: service_healthy
nestjs-graphql-redis:
condition: service_healthy
command: npm run start:dev # Run in development mode
nestjs-graphql-mysql:
container_name: nestjs-graphql-mysql
image: mysql:8.0
restart: unless-stopped
volumes:
- mysql:/var/lib/mysql
ports:
- 3307:${DB_PORT}
networks:
- nestjs-graphql-intranet
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
TZ: 'utc'
command: --default-authentication-plugin=mysql_native_password
healthcheck:
test: ['CMD', 'mysqladmin', '-u${DB_USER}', '-p${DB_PASSWORD}', 'ping']
interval: 5s
retries: 3
timeout: 3s
nestjs-graphql-redis:
container_name: nestjs-graphql-redis
image: redis:alpine
restart: unless-stopped
volumes:
- redis:/data
ports:
- 6380:${REDIS_PORT}
networks:
- nestjs-graphql-intranet
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
retries: 3
timeout: 3s
volumes:
mysql:
name: nestjs-graphql-mysql
redis:
name: nestjs-graphql-redis
networks:
nestjs-graphql-intranet:
name: nestjs-graphql-intranet
driver: bridge