-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
37 lines (37 loc) · 1.59 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
# docker-compose for local development.
# Uses settings tailored for quick builds and verbose output.
# Rebuilds the app upon detecting source code changes.
version: "3.8"
services:
client:
build:
context: ./client/
# use the .dev image definition. It is well suited for local development.
dockerfile: Dockerfile.dev
volumes:
# Make client source code visible to the container. Whenever you make a copy in
# client/, the image will see it and rebuild the app.
- ./client:/app
# This volume tells our app to use the container's variant of node_modules.
# If you look at client/Dockerfile, you'll notice that it installs dependencies from package.json
# to /app/node_modules. In the line above, we've shadowed the /app folder with a local, non-docker
# copy of ./client. This volume tells our image to ignore our shadowing for node_modules.
# (TLDR: we only have to invoke `npm install` inside the container, not outside of it).
- /app/node_modules
ports:
- "8080:8080"
server:
build:
context: ./server/
dockerfile: Dockerfile
volumes:
# Same as above.
# See comments in client for details.
- ./server:/app
- /app/node_modules
ports:
- "3000:3000"
command:
# The only difference between a dev and prod environment is the command used to start the app.
# Use the same Dockerfile, but overwrite its command.
npm run watch