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
77services:
db:
image: mysql:8.0
volumes:
- mysql_data:/var/lib/mysql
- ./my.cnf:/etc/mysql/conf.d/my.cnf
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: storyblok
MYSQL_USER: app
MYSQL_PASSWORD: password
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "$$MYSQL_USER", "--password=$$MYSQL_PASSWORD"]
interval: 5s
timeout: 5s
retries: 5
api:
build: .
volumes:
- .:/app
- bundle_cache:/usr/local/bundle
ports:
- "3000:3000"
environment:
- RAILS_ENV=development
- DATABASE_URL=mysql2://app:password@db:3306/storyblok
depends_on:
db:
condition: service_healthy
test_migrate:
build: .
volumes:
- .:/app
- bundle_cache:/usr/local/bundle
environment:
- RAILS_ENV=test
- DATABASE_URL=mysql2://app:password@db:3306/storyblok_test
depends_on:
db:
condition: service_healthy
command: >
sh -c '
bundle exec rails db:migrate &&
touch /app/tmp/migration_done
'
healthcheck:
test: ["CMD-SHELL", "[ -f /app/tmp/migration_done ]"]
interval: 1s
timeout: 1s
retries: 60
start_period: 5s
test:
build: .
volumes:
- .:/app
- bundle_cache:/usr/local/bundle
environment:
- RAILS_ENV=test
- DATABASE_URL=mysql2://app:password@db:3306/storyblok_test
- RSPEC_FORMAT=documentation
depends_on:
db:
condition: service_healthy
test_migrate:
condition: service_completed_successfully
command: bundle exec rspec --format documentation --color --format progress
volumes:
mysql_data:
bundle_cache: