-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
118 lines (109 loc) · 2.8 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
version: '3'
volumes:
app:
db:
redis:
services:
# Run an instance of MySQL with a database named 'development' for running specs. See config/database.yml
db:
image: mysql:5.7
restart: always
container_name: db
environment:
- MYSQL_ROOT_PASSWORD=12341234
- MYSQL_PASSWORD=12341234
- MYSQL_DATABASE=development
volumes:
- db:/var/lib/mysql
- ./config/mysql/mysqld.cnf:/etc/mysql/conf.d/custom.cnf
expose:
- 3306
##
# Run an instance of MySQL with a database named 'test' for running specs. See config/database.yml. Has no volume
# and doesn't intend on persisting data across sessions.
db_test:
image: mysql:5.7
restart: always
container_name: db_test
environment:
- MYSQL_ROOT_PASSWORD=12341234
- MYSQL_PASSWORD=12341234
- MYSQL_DATABASE=test
volumes:
- ./config/mysql/mysqld.cnf:/etc/mysql/conf.d/custom.cnf
web:
build:
context: .
dockerfile: Dockerfile
environment:
- RAILS_ENV=${RAILS_ENV}
container_name: web
command: >
bash -c "rm -f tmp/pids/server.pid
&& bundle exec rails server -p 3000 -b '0.0.0.0' -e ${RAILS_ENV}"
depends_on:
caddy:
condition: service_started
db:
condition: service_started
db_test:
condition: service_started
redis:
condition: service_started
volumes:
- .:/data
- app:/data/tmp/uploads
expose:
- 3000
stdin_open: true
tty: true
##
# Ensure that the database migrations are run on the appropriate database related to the RAILS_ENV running
# db_migrate:
# extends: app
# container_name: db_migrate
# restart: on-failure
# command: bundle exec rails db:migrate RAILS_ENV=${RAILS_ENV}
# depends_on:
# - db
##
# Runs sidekiq to process background jobs
workers:
build:
context: .
dockerfile: Dockerfile
environment:
- RAILS_ENV=${RAILS_ENV}
volumes:
- .:/data
- app:/data/tmp/uploads
container_name: workers
command: bundle exec sidekiq -L /dev/stdout
depends_on:
caddy:
condition: service_started
db:
condition: service_started
db_test:
condition: service_started
redis:
condition: service_started
##
# Redis for the background job queues
redis:
image: redis:alpine
container_name: redis
volumes:
- redis:/data
caddy:
image: caddy:2.3.0
container_name: caddy
ports:
- "3000:3000"
volumes:
- ./caddy:/etc/caddy
environment:
- ADMIN_USER=${ADMIN_USER:-admin}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- ADMIN_PASSWORD_HASH=${ADMIN_PASSWORD_HASH:-JDJhJDE0JE91S1FrN0Z0VEsyWmhrQVpON1VzdHVLSDkyWHdsN0xNbEZYdnNIZm1pb2d1blg4Y09mL0ZP}
restart: unless-stopped