-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
63 lines (60 loc) · 3.16 KB
/
docker-compose.yml
File metadata and controls
63 lines (60 loc) · 3.16 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
services:
db:
image: postgres:12-alpine
volumes:
- cma_db_volume:/var/lib/postgresql/data
ports:
- "54320:5432"
env_file:
- .env
# If you need to enable a proxy for testing, set GLOBAL_AGENT_HTTP_PROXY=http://proxy:3128 in .env and uncomment the
# following: (See the 'app' section for details on how to require traffic to go via this proxy)
# proxy:
# image: hinata/nginx-forward-proxy
# ports:
# - "3128:3128"
app:
build:
context: .
target: development
# Used to support the API returning diagnostic information about which versions of the app and image it is
# running. In the local development environment the DOCKER_TAG will always be latest. We get the git commit hash
# by running `git rev-parse HEAD`. However, that type of interpolation is not supported in a `docker.compose.yml`
# file. So, we have to rely on it having been set as an env var locally before `docker compose up` is run.
# If you checkout `.vscode/tasks.json` you'll see we've baked it into our start CMA environment command.
args:
- GIT_COMMIT=${GIT_COMMIT}
- DOCKER_TAG=latest
ports:
- "3003:3000"
- "9229:9229"
- "9230:9230"
volumes:
# Bind mount the local folder into the container at `/home/node/app` when the container starts. This is what
# gives us the ability to edit files on the host but have them run within the docker container.
#
# Note: the delegated option is just a performance optimisation for Macs. The docker compose default mode is
# 'consistent'. This means any time a write happens it is immediately flushed to all participants of the mount.
# 'cached' means the host is the authority; changes on the host will eventually reach the container. 'delegated'
# means the container is the authority; changes made in it will eventually reach the host. 'delegated' is seen as
# the most suitable option for bind mounts containing source code and provides the best performance on Macs.
- .:/home/node/app:delegated
# Bind-mounting these two files will let you add packages during development without rebuilding, for example,
# to add bower to your app while developing, just install it inside the container and then nodemon will restart.
# Your changes will last until you "docker compose down" and will be saved on host for next build
- ./package.json:/home/node/package.json
- ./package-lock.json:/home/node/package-lock.json
# This is a workaround to prevent the host node_modules from accidently getting mounted in the container in case
# you want to use either `node` or `npm` outside it, for example, to run linting.
- cma_notused:/home/node/app/node_modules
env_file:
- .env
# Run these services first before you run this one. Note, it does not wait or check to ensure the service is fully
# up and running before starting the app. So do not use this to manage critical dependency ordering.
depends_on:
- db
# If you want to require traffic to go via a proxy, uncomment the line below:
# dns: 0.0.0.0
volumes:
cma_db_volume:
cma_notused: