-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
70 lines (66 loc) · 1.69 KB
/
docker-compose.yml
File metadata and controls
70 lines (66 loc) · 1.69 KB
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
version: '3.8'
services:
mysql:
image: mysql:8.0
container_name: imlate-mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: tracker
MYSQL_USER: trackme
MYSQL_PASSWORD: trackme
ports:
- "3307:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
command: >
--port=3306
--mysqlx=0
--group_concat_max_len=320000
--log_bin_trust_function_creators=1
--sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "trackme", "-ptrackme"]
interval: 5s
timeout: 5s
retries: 10
networks:
- imlate-network
app:
build:
context: .
dockerfile: docker/Dockerfile.dev
container_name: imlate-app
environment:
ENVIRONMENT: development
DATABASE_HOST: mysql
DATABASE_PORT: 3306
DATABASE_USERNAME: trackme
DATABASE_PASSWORD: trackme
DATABASE_NAME: tracker
ports:
- "8080:8080"
volumes:
- .:/app
- go_modules:/go/pkg/mod
depends_on:
mysql:
condition: service_healthy
networks:
- imlate-network
command: >
bash -c "
echo 'Waiting for MySQL to be ready...' &&
sleep 5 &&
migrate -database 'mysql://trackme:trackme@tcp(mysql:3306)/tracker' -path /app/migrations up &&
echo 'Migrations applied successfully' &&
go run cmd/app/main.go
"
volumes:
mysql_data:
driver: local
go_modules:
driver: local
networks:
imlate-network:
driver: bridge