-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
72 lines (65 loc) · 2.46 KB
/
docker-compose.yaml
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
# version:
# Docker no longer relies on the use of the version: field
services:
# the following service names are arbitrary, but the chosen names will correspond to the host names
# each service should have it's own Dockerfile
web:
# let's build an image from Dockerfile
build: ./frontend
ports:
- 3000:3000
# volumes:
# - ./frontend:/app
# see api volumes service section
web-test:
image: multi-container-application-web
# use image that will be created by web service
# the name of the image that we have to write here is corresponds to a name that was
# autogenerated as the joini of the <code repo name> and the 'web' service above
# e.g. image: <repo name>-<service name>
# volumes:
# - ./frontend:/app
# see api volumes service section
command: npm test
api:
build: ./backend
ports:
- 3001:3001
environment:
DB_URL: mongodb://db/vidly
# point to the db host which is defined under services
# volumes:
# - ./backend:/app
# enables seeing changes in the source-code right away in the container
# however this will require having npm installed in the host machine
# one or multiple of these options could work here but let's handle it in the /backend/Dockerfile:
# command: ./wait-for db:27017 && migrate-mongo up && npm start
# will override the CMD of /backend/Dockerfile
# command: ./docker-entrypoint.sh
# same as above but the commands we want are written out in ./docker-entrypoint.sh
# not working on Ubuntu
command: ["sh", "docker-entrypoint.sh"]
# https://forum.codewithmosh.com/t/backend-not-starting-in-vidly-app/3753/4
# working on Ubuntu
# entrypoint: ['sh', './docker-entrypoint.sh']
api-test:
image: multi-container-application-api
# use image that will be created by api service
# the name of the image that we have to write here is corresponds to a name that was
# autogenerated as the joini of the <code repo name> and the 'api' service above
# e.g. image: <repo name>-<service name>
# volumes:
# - ./backend:/app
# see api volumes service section
command: npm test
db:
# pull image from dockerhub
image: mongo:4.0-xenial
ports:
- 27017:27017
volumes:
- vidly:/data/db
# /data/db is the default for mongodb
# gives the database permanence after the container is stopped
volumes:
vidly: