forked from hackforla/CivicTechJobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
60 lines (55 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
version: "3.8"
services:
pgdb:
image: postgres
container_name: pgdb
volumes:
- postgres_data:/lib/postgresql/data
env_file:
- ./dev/dev.env
django:
build:
context: ./backend
dockerfile: ../dev/django.dockerfile
container_name: django
command: >
sh -c "python manage.py makemigrations &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000 &&
python manage.py generateschema --file openapi-schema.yml"
volumes:
- ./backend/:/code
ports:
- "0.0.0.0:8000:8000"
env_file:
- ./dev/dev.env
depends_on:
- pgdb
webpack:
build:
context: ./frontend
dockerfile: ../dev/webpack.dockerfile
container_name: webpack
command: npm --prefix ./frontend run watch # We need the prefix because we are mounting from parent rather than frontend
env_file:
- ./dev/dev.env
volumes:
- ./:/code # The webpack output files are now in a sibling directory, therefore, we need to mount to parent
- node_modules:/code/node_modules # Need to persist node_modules directory to prevent it from being overwritten by local directory mount (on line 40). This ensures npm packages installed during Docker build are available at runtime.
linter:
profiles: ["lint"]
build:
context: .
dockerfile: ./dev/linter.dockerfile
container_name: linter
environment:
- PRE_COMMIT_HOME=${HOME}/.cache/pre-commit
user: ${UID}:${GID}
env_file:
- ./dev/linter.env
volumes:
- .:/src:rw
- ${HOME}/.cache:${HOME}/.cache:rw
volumes:
postgres_data:
node_modules: