-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
docker-compose.yml
125 lines (116 loc) · 2.93 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
version: '3.8'
services:
api:
build:
context: .
dockerfile: docker/api/Dockerfile
depends_on:
shared-volume-init:
condition: service_completed_successfully
mysql:
condition: service_healthy
group_add:
- '1000'
volumes:
- ./migrations:/migrations
- go-modules:/go/pkg/mod
- shared-volume:/tmp/2fas
ports:
- "80:8080"
env_file:
- .env
admin:
build:
context: .
dockerfile: docker/admin/Dockerfile
depends_on:
shared-volume-init:
condition: service_completed_successfully
mysql:
condition: service_healthy
group_add:
- '1000'
volumes:
- shared-volume:/tmp/2fas
ports:
- "8082:8080"
env_file:
- .env
websocket:
build:
context: .
dockerfile: docker/websocket/Dockerfile
depends_on:
- mysql
ports:
- "8081:8081"
env_file:
- .env
mysql:
image: mysql:8
volumes:
- ./data/mysql:/var/lib/mysql
- ./docker/mysql/dev-schema.sql:/docker-entrypoint-initdb.d/schema.sql
ports:
- "127.0.0.1:3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
redis:
image: bitnami/redis:latest
ports:
- "127.0.0.1:6379:6379"
environment:
- ALLOW_EMPTY_PASSWORD=yes
# docker compose always mount named volumes as root (https://github.com/docker/compose/issues/3270)
# and without changing permission, we want be able to access shared volume
shared-volume-init:
image: ubuntu
user: root
group_add:
- '1000'
volumes:
- shared-volume:/tmp/2fas
command: chown -R 1000:1000 /tmp/2fas
pass:
build:
context: .
dockerfile: docker/pass/Dockerfile
group_add:
- '1000'
ports:
- "8088:8082"
environment:
# overwrite AWS_ENDPOINT from .env file. One in env is used to running app from local also.
AWS_ENDPOINT: http://localstack-main:4566
AWS_REGION: us-east-1
env_file:
- .env
depends_on:
localstack:
condition: service_healthy
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack
ports:
- "127.0.0.1:4566:4566"
environment:
- DEBUG=1
healthcheck:
test: >-
curl -s localhost:4566/_localstack/health | grep -q '"kms": "running"'
interval: 5s
timeout: 5s
retries: 5
volumes:
- "./e2e-tests/localstack_init.sh:/etc/localstack/init/ready.d/localstack_init.sh" # ready hook
- "./data/localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
volumes:
go-modules:
# shared-volume is used to share volume between api and admin. On producition AWS S3 is used,
# but here for local dev shared volume is fine.
shared-volume: