-
-
Notifications
You must be signed in to change notification settings - Fork 321
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
88 lines (80 loc) · 2.78 KB
/
Copy pathdocker-compose.yml
File metadata and controls
88 lines (80 loc) · 2.78 KB
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
name: alchemy_cms
# All services run the same image, which is built once by the `setup` service.
# The other services reference it via this anchor and set `pull_policy: never`
# so Compose uses the locally built image instead of trying to pull it from a
# registry on a cold start (which it does concurrently with the build).
x-app: &app
image: alchemy-dummy-app
pull_policy: never
# Gems and node_modules are baked into the image. Gems live outside the
# `.:/workspace` bind mount, so they are served straight from the image with no
# volume. node_modules sits under the bind mount, so an anonymous volume
# (`- /workspace/node_modules`) shadows the host directory and surfaces the
# image's copy instead of the host's (which has platform-specific binaries).
# After changing dependencies, rebuild the image; refresh node_modules with
# `docker compose up --build --renew-anon-volumes`.
#
# USER_ID/GROUP_ID select the uid/gid of the image's `alchemy` user, which has to
# own the `.:/workspace` bind mount to be able to write into it. `bin/start` sets
# them from the host user, so the documented entry point needs no configuration.
services:
setup:
image: alchemy-dummy-app
build:
context: .
dockerfile: .devcontainer/Dockerfile
args:
USER_ID: ${USER_ID:-1000}
GROUP_ID: ${GROUP_ID:-1000}
# The image resolves the whole bundle fresh (bundle update --all). Regenerate
# the disposable host Gemfile.lock from the baked gems so it matches the image
# without needing a compiler at runtime, then install JS deps.
command: bash -c "rm -f Gemfile.lock && bundle install --local && pnpm install"
volumes:
- .:/workspace
- /workspace/node_modules
web:
<<: *app
command: bash -c "cd spec/dummy && rm -f tmp/pids/server.pid && bin/rails db:prepare && exec bin/rails server -b 0.0.0.0"
ports:
- "3000:3000"
volumes:
- .:/workspace
- /workspace/node_modules
- storage:/workspace/spec/dummy/storage
depends_on:
setup:
condition: service_completed_successfully
css:
condition: service_started
js:
condition: service_started
sass:
<<: *app
command: pnpm run build:css --watch
volumes:
- .:/workspace
- /workspace/node_modules
depends_on:
setup:
condition: service_completed_successfully
css:
<<: *app
command: bash -c "cd spec/dummy && bin/rails dartsass:watch"
volumes:
- .:/workspace
- /workspace/node_modules
depends_on:
setup:
condition: service_completed_successfully
js:
<<: *app
command: pnpm run build:admin:dev
volumes:
- .:/workspace
- /workspace/node_modules
depends_on:
setup:
condition: service_completed_successfully
volumes:
storage: