-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
64 lines (61 loc) · 1.88 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
version: "3"
services:
postgres:
container_name: pg-container
image: postgres:latest
env_file:
- .env
restart: always
volumes:
- ./data:/var/lib/postgresql/data
ports:
- "5432:5432"
postgres_test:
container_name: pg-test-container
image: postgres:latest
env_file:
- .env.test
restart: always
volumes:
- ./data_test:/var/lib/postgresql/data
ports:
- "5433:5432"
migration_runner_test:
container_name: migration-runner_test
image: ruby:latest
working_dir: /usr/src/ruby-clean-api
command: bash -c "bundle install && bundle exec ruby ./src/main/config/migrations.rb && bundle exec ruby ./src/infrastructure/db/seeds.rb"
env_file:
- .env.test
environment:
- POSTGRES_HOST=postgres_test
- POSTGRES_PORT=5432
volumes:
- ./src:/usr/src/ruby-clean-api/src
- ./Gemfile:/usr/src/ruby-clean-api/Gemfile
- ./config.ru:/usr/src/ruby-clean-api/config.ru
- ./Gemfile.lock:/usr/src/ruby-clean-api/Gemfile.lock
- ./package.json:/usr/src/ruby-clean-api/package.json
depends_on:
- postgres_test
api:
container_name: api-container
image: ruby:latest
working_dir: /usr/src/ruby-clean-api
restart: always
command: bash -c "bundle install && ruby ./src/main/config/migrations.rb && ruby ./src/infrastructure/db/seeds.rb && rerun -- rackup -p 5050 -r ./src/main/server.rb -s puma -o 0.0.0.0 2>/dev/null"
depends_on:
- postgres
- postgres_test
env_file:
- .env
environment:
- POSTGRES_HOST=postgres
volumes:
- ./src:/usr/src/ruby-clean-api/src
- ./Gemfile:/usr/src/ruby-clean-api/Gemfile
- ./config.ru:/usr/src/ruby-clean-api/config.ru
- ./Gemfile.lock:/usr/src/ruby-clean-api/Gemfile.lock
- ./package.json:/usr/src/ruby-clean-api/package.json
ports:
- "5050:5050"