-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
61 lines (58 loc) · 2.08 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
61 lines (58 loc) · 2.08 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
# Stellar_Card — development overlay.
#
# Layer this on top of the base stack to get a real development loop:
#
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up
#
# What it changes, relative to docker-compose.yml:
#
# * Builds the `dev` stage of each Dockerfile instead of the production one,
# so the containers run `node --watch` and `next dev` rather than a
# pre-built bundle.
# * Bind-mounts the host source into the container, so an edit on the host is
# picked up without a rebuild.
# * Drops `restart: unless-stopped`. A crash loop during development should
# stop and show you the error, not silently restart forever.
#
# The `node_modules` named volumes are the important detail: without them the
# bind mount would shadow the container's installed dependencies with the
# host's directory, which is either absent or built for a different platform.
services:
backend:
build:
target: dev
image: stellar_card-backend:dev
environment:
- NODE_ENV=development
volumes:
- ./stellar_card-backend/src:/app/src
- ./stellar_card-backend/jsconfig.json:/app/jsconfig.json:ro
- backend-data:/app/data
- backend-node-modules:/app/node_modules
restart: "no"
frontend:
build:
target: dev
image: stellar_card-frontend:dev
environment:
- NODE_ENV=development
- NEXT_PUBLIC_API_BASE_URL=http://localhost:4000
# Container filesystems often miss inotify events across a bind mount;
# polling is slower but is the difference between hot reload working and
# silently not working.
- WATCHPACK_POLLING=true
- CHOKIDAR_USEPOLLING=true
volumes:
- ./stellar_card-frontend:/app
- frontend-node-modules:/app/node_modules
# `.next` must stay container-side: it holds build output compiled for
# the container's platform, and sharing it with the host corrupts both.
- frontend-next-cache:/app/.next
restart: "no"
volumes:
backend-node-modules:
driver: local
frontend-node-modules:
driver: local
frontend-next-cache:
driver: local