-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
108 lines (104 loc) · 2.67 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
version: '3.7'
x-variables: &variables
ENV_STAGE: local
services:
web:
build:
context: .
dockerfile: docker/dev/web/Dockerfile
entrypoint: /entrypoint.sh
volumes:
- ./web/:/usr/src/web/:cached
- redis_socket:/redis_socket
- postgres_socket:/postgres_socket
ports:
- 8000:8000
environment:
<<: *variables
env_file:
- docker/dev/env/.env
- docker/dev/env/.db.env
- docker/prod/env/.data.env
depends_on:
- db
- redis
restart: unless-stopped
networks:
- microservice_network
- separated_network
extra_hosts:
- "docker-gateway-host:172.17.0.1" # Linux OS get access from docker container to localhost
# host.docker.internal - For docker in Windows. No other action is required.
# If You need to connect to PostgreSql in localhost, just use host.docker.internal instead of localhost
# Verify that the 177/10 subnet is in your Docker network otherwise change to proper subnet
healthcheck:
test: curl --fail -s http://localhost:8000$$HEALTH_CHECK_URL || exit 1
interval: 1m30s
timeout: 3s
retries: 3
db:
build:
context: .
dockerfile: docker/dev/db/Dockerfile
hostname: postgres
restart: unless-stopped
volumes:
- postgres_data:/var/lib/postgresql/data/
- postgres_socket:/postgres_socket
env_file:
- docker/dev/env/.db.env
networks:
- separated_network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
interval: 50s
timeout: 5s
retries: 5
redis:
build:
context: .
dockerfile: ./docker/dev/redis/Dockerfile
restart: unless-stopped
volumes:
- redis_data:/data
- redis_socket:/redis_socket
networks:
- separated_network
healthcheck:
test: [ "CMD", "redis-cli","ping" ]
interval: 1m20s
timeout: 5s
retries: 3
celery:
build:
context: .
dockerfile: docker/dev/web/Dockerfile
command: celery -A src worker -l info -Q celery
volumes:
- ./web/:/usr/src/web/:cached
- redis_socket:/redis_socket
- postgres_socket:/postgres_socket
environment:
<<: *variables
env_file:
- docker/dev/env/.env
- docker/dev/env/.db.env
- docker/prod/env/.data.env
depends_on:
- redis
restart: unless-stopped
networks:
- separated_network
extra_hosts:
- "docker-gateway-host:172.17.0.1"
volumes:
postgres_data:
redis_data:
redis_socket:
postgres_socket:
networks:
microservice_network:
driver: bridge
name: local_microservice_network
separated_network:
driver: bridge