-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
105 lines (95 loc) · 2.6 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
# Adapted from this DigitalOcean tutorial:
# https://www.digitalocean.com/community/tutorials/containerizing-a-ruby-on-rails-application-for-development-with-docker-compose
# ...as well as from these guides:
# https://www.codewithjason.com/dockerize-rails-application/
# https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development
version: "3.8"
x-rails: &rails
build:
context: ./backend
dockerfile: Dockerfile
stdin_open: true
tty: true
volumes:
- ./backend:/app:cached
- bundle:/usr/local/bundle
env_file: ./backend/.env
environment:
RAILS_ENV: "${RAILS_ENV:-development}"
SEARCHER_BASE_URL: "http://searx:8080"
#
# From "Ruby on Whales":
#
# We also _tell_ Docker to use tmpfs for `/tmp` folder within a container
# and also for the `tmp/pids` folder of our application--this way we
# ensure that no `server.pid` survives the container exit (say good-bye to
# "A server is already started" errors):
#
tmpfs:
- /tmp
- /app/tmp/pids
services:
rails_runner:
<<: *rails
stdin_open: true
tty: true
depends_on:
- postgres
- redis
ports:
- "9876:9876" # for pry-remote
profiles:
- debug
entrypoint: ./entrypoints/rails-runner-entrypoint.sh
backend:
<<: *rails
stdin_open: true
tty: true
depends_on:
- postgres
- redis
ports:
- "3000:3000"
- "9876:9876" # for pry-remote
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
stdin_open: true
tty: true
ports:
- "8080:8080"
volumes:
- ./frontend:/app:cached
- node_modules:/app/node_modules
environment:
VITE_BACKEND_BASE_URL: "http://localhost:3000"
VITE_SEARCHER_BASE_URL: "http://localhost:3000" # tunnel through backend
stop_signal: SIGKILL # sending TERM to `pnpm run ...` does not propagate TERM to child processes (see https://github.com/pnpm/pnpm/issues/2653) so it takes forever to stop
searx:
image: searx/searx
volumes:
- ./searx:/etc/searx
environment:
BASE_URL: "http://localhost:9090/"
stop_signal: SIGQUIT # doesn't stop with TERM but QUIT seems to work just fine
sidekiq:
<<: *rails
depends_on:
- postgres
- redis
entrypoint: ./entrypoints/sidekiq-entrypoint.sh
postgres:
image: postgres:14.1
restart: always
volumes:
- ./backend/init.sql:/docker-entrypoint-initdb.d/init.sql
- db_data:/var/lib/postgresql/data
env_file: ./backend/.env
redis:
image: redis:6.2
restart: always
volumes:
bundle:
db_data:
node_modules: