-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
39 lines (39 loc) · 1.63 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
# This file is only used to set up local development. When Docker images are built for production,
# the Dockerfile is solely used.
version: "3.7"
services:
# db is a service which sets up a local database used for testing purposes.
# For production, Terraform points the Node server to speak with RDS via environment variables.
db:
image: charliemcgrady-db
build:
context: "./dev/db"
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: charliemcgrady
ports:
- "5432:5432"
node-server:
image: charliemcgrady-node-server
build:
# Although the code bundled in the final image is contained within ./app/server, the context
# of the build needs to be the parent directly so we can link shared packages (e.g. rgb-commons)
context: "./app"
dockerfile: Dockerfile-node-server
# Sleep to wait for DB to accept connections, then install app, run migrations, and start server
command: sh -c "sleep 10 && echo 'Starting node server' && npm run migrate-db && npm run start"
volumes:
# Mount ./app as a volume to enable hot reloading of the app during development.
# The process is as follows:
# - The 'command' attribute define above executes `npm run start` (defined in package.json).
# This command starts nodemon, which will restart the server if files in ./app/dist change
# - `npm run dev` starts the typescript compiler. Any changes are placed in ./app/dist,
# and nodemon restarts the server
- ./app:/usr/app
env_file:
- .env
depends_on:
- db
ports:
- "4000:4000"