-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
113 lines (105 loc) · 2.71 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
x-app: &app
build:
context: .
cache_from:
- ${CONTAINER_TEST_IMAGE:-relaunch-community}
args:
BUILDKIT_INLINE_CACHE: '1'
RUBY_VERSION: '3.2.2'
PG_MAJOR: '14'
NODE_MAJOR: '16'
image: ${CONTAINER_TEST_IMAGE:-relaunch-community}
environment: &env
NODE_ENV: ${NODE_ENV:-development}
RAILS_ENV: ${RAILS_ENV:-development}
tmpfs:
- /tmp
- /app/tmp/pids
x-backend: &backend
<<: *app
stdin_open: true
tty: true
volumes:
- .:/app:cached
- bundle:/usr/local/bundle
- rails_cache:/app/tmp/cache
- assets:/app/public/assets
- node_modules:/app/node_modules
- history:/usr/local/hist
- ./.dockerdev/.psqlrc:/root/.psqlrc:ro
- ./.dockerdev/.bashrc:/root/.bashrc:ro
environment: &backend_environment
<<: *env
DATABASE_URL: postgres://relaunch_community:relaunch_community@postgres:5432
REDIS_URL: redis://redis:6379/1
MALLOC_ARENA_MAX: 2
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-1}
BOOTSNAP_CACHE_DIR: /usr/local/bundle/_bootsnap
XDG_DATA_HOME: /app/tmp/cache
YARN_CACHE_FOLDER: /app/node_modules/.yarn-cache
HISTFILE: /usr/local/hist/.bash_history
PSQL_HISTFILE: /usr/local/hist/.psql_history
IRB_HISTFILE: /usr/local/hist/.irb_history
EDITOR: vi
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- webapp
version: '3.8'
services:
rails:
<<: *backend
command: sh -c "bundle && bundle exec rails"
ports:
- 3000:3000
rails-test:
<<: *backend
environment:
RAILS_ENV: ${RAILS_ENV:-test}
RAILS_MASTER_KEY: ${RAILS_MASTER_KEY:-}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
PGPASSWORD: ${POSTGRES_PASSWORD:-postgres}
command: sh -c "bundle && bundle exec rspec spec"
redis:
image: redis:7.0.7
command: redis-server --appendonly yes
ports:
- 6379:6379
healthcheck:
test: "[ $$(redis-cli ping) = 'PONG' ]"
networks:
- webapp
volumes:
- redis:/data
postgres:
image: postgres:14
volumes:
- ./.dockerdev/psqlrc:/root/.psqlrc:ro
- ./.dockerdev/postgresql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro
- postgres:/var/lib/postgresql/data
- history:/usr/local/hist
environment:
PSQL_HISTFILE: /usr/local/hist/.psql_history
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
healthcheck:
test: pg_isready -U postgres -h 127.0.0.1
interval: 5s
networks:
- webapp
networks:
webapp:
volumes:
bundle:
node_modules:
history:
rails_cache:
postgres:
redis:
assets: