-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yaml
121 lines (111 loc) · 3.35 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2020-2023, The Chancellor, Masters and Scholars of the University
# of Oxford, and the 'Galv' Developers. All rights reserved.
# This docker-compose setup is for local dev purposes only.
# Its role is to connect the backend to a postgres database.
version: "3.8"
services:
app:
image: app
build:
dockerfile: Dockerfile
context: .
depends_on:
- postgres
- mailhog
volumes:
- ./backend_django:/code/backend_django
- ./.dev/spec:/spec
# datafiles should be mounted to DATA_ROOT in the container
- ./.dev/datafiles:/galv_files/data
# staticfiles to STATIC_ROOT
- ./.dev/.static_files:/galv_files/static
# and media files to MEDIA_ROOT
- ./.dev/.media_files:/galv_files/media
# copy logs for easy access
- ./.dev/logs:/var/log/galv
- ./.dev/logs_harvester:/opt/project/backend_django/.harvester
environment:
VIRTUAL_HOST: "localhost"
FRONTEND_VIRTUAL_HOST: "http://${VIRTUAL_HOST_ROOT},https://${VIRTUAL_HOST_ROOT},http://localhost:8002"
DJANGO_SETTINGS: "dev"
DJANGO_LOG_LEVEL: "DEBUG"
DJANGO_SUPERUSER_PASSWORD: "admin"
env_file:
- ./.env
- ./.env.secret
restart: unless-stopped
ports:
- "8001:80"
# Replace the gnuicorn server with the Django development runserver
command: "python manage.py runserver 0.0.0.0:8000"
mailhog:
image: mailhog/mailhog
ports:
- "8025:8025"
- "1025:1025"
postgres:
image: "postgres:14"
stop_signal: SIGINT # Fast Shutdown mode
volumes:
- "./.dev/data:/var/lib/postgresql/data"
environment:
# variables listed as defaults in backend_django/config/settings_dev.py
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_DB: "galv"
POSTGRES_PORT: "5432"
restart: unless-stopped
app_test:
image: app-test
build:
dockerfile: Dockerfile-test
context: .
depends_on:
- postgres
volumes:
- ./.test/.static_files:/galv_files/static
- ./backend_django:/code/backend_django
- ./.dev/logs:/var/log/galv
environment:
FRONTEND_VIRTUAL_HOST: "http://localhost"
VIRTUAL_HOST: "localhost"
VIRTUAL_HOST_ROOT: "localhost"
DJANGO_SETTINGS: "dev"
env_file:
- ./.env
restart: "no"
make_spec:
image: app-spec
build:
dockerfile: Dockerfile-test
context: .
volumes:
- ./.dev/spec:/spec
- ./backend_django:/code/backend_django
environment:
FRONTEND_VIRTUAL_HOST: "http://localhost"
VIRTUAL_HOST: "localhost"
VIRTUAL_HOST_ROOT: "localhost"
DJANGO_SETTINGS: "dev"
env_file:
- ./.env
restart: "no"
command: "../make_spec.sh"
check_spec:
image: openapitools/openapi-diff
volumes:
- ./.dev/spec:/spec
entrypoint: /bin/sh -c
environment:
REMOTE_SPEC_SOURCE: "https://github.com/galv-team/galv-spec/releases/latest/download/galv-spec.json"
command: ["java -jar /app/openapi-diff.jar --fail-on-incompatible --markdown /spec/diff.md $${REMOTE_SPEC_SOURCE} $$(ls /spec/openapi-*.json | tail -n 1)"]
docs:
build:
dockerfile: Dockerfile
context: ./docs
volumes:
- ./docs/source:/source
- ./docs/build-dev:/build
ports:
- "8005:80"