-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-compose.yml
168 lines (157 loc) · 4.91 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
services:
# Run webpack-dev-server and compile static assets.
#
# This is the primary server and it proxies the
# Django app so that Webpack can watch for file changes.
assets:
build:
context: .
target: assets
image: mozmeao/birdbox_assets:${GIT_COMMIT:-latest}
platform: linux/amd64
command: npm run watch
ports:
- "8000-8010:8000-8010"
volumes:
- ./src/:/app/src:delegated
- ./birdbox/:/app/birdbox:delegated
- ./assets/:/app/assets:delegated
environment:
WP_PROXY_URL: "http://app:8080"
# The Django app
app:
build:
context: .
target: devapp
command: python birdbox/manage.py runserver 0.0.0.0:8080
depends_on:
- db
- redis
env_file: ./docker/envfiles/local.env
environment:
DATABASE_URL: postgres://postgres:postgres@db/postgres
REDIS_URL: redis://redis:6379
image: mozmeao/birdbox_test:${GIT_COMMIT:-latest}
platform: linux/amd64
ports:
- "8080:8080"
volumes:
- ./birdbox/:/app/birdbox:delegated
- ./bin/:/app/bin:delegated
- ./local-credentials/:/app/local-credentials:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./src/:/app/src:delegated
- ./root_files/:/app/root_files:delegated
- ./wsgi/:/app/wsgi:delegated
- ./assets/:/app/assets:delegated
# run the tests against local changes
test:
image: mozmeao/birdbox_test:${GIT_COMMIT:-latest}
depends_on:
- db
- redis
env_file: docker/envfiles/test.env
environment:
DATABASE_URL: postgres://postgres:postgres@db/postgres
REDIS_URL: redis://redis:6379
volumes:
# NB: no ./local-credentials mounted as not needed
- ./birdbox/:/app/birdbox:delegated
- ./bin/:/app/bin:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./src/:/app/src:delegated
- ./root_files/:/app/root_files:delegated
- ./tests/:/app/tests:delegated
- ./wsgi/:/app/wsgi:delegated
# run tests with no volumes
test-image:
image: mozmeao/birdbox_test:${GIT_COMMIT:-latest}
depends_on:
- db
- redis
environment:
DATABASE_URL: postgres://postgres:postgres@db/postgres
REDIS_URL: redis://redis:6379
env_file: docker/envfiles/test.env
# The production-grade Django app, run locally, without local env vars
release:
build:
context: .
target: release
args:
GIT_SHA: ${GIT_COMMIT:-latest}
depends_on:
- db
- redis
env_file: ./docker/envfiles/prod.env
environment:
ALLOWED_HOSTS: "*"
CSRF_TRUSTED_ORIGINS: "*"
DATABASE_URL: postgres://postgres:postgres@db/postgres
EMAIL_BACKEND: "django.core.mail.backends.console.EmailBackend"
REDIS_URL: redis://redis:6379
SECRET_KEY: "This is not the 53cr3t k3Y, it is just a tribute"
USE_SECURE_PROXY_HEADER: False
image: mozmeao/birdbox:${GIT_COMMIT:-latest}
platform: linux/amd64
ports:
- "8000:8000"
volumes:
# NB: ./local-credentials not mounted because we're not running with
# external env vars to be able to benefit from them
- ./birdbox/:/app/birdbox:delegated
- ./bin/:/app/bin:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./lib/:/app/lib:delegated
- ./root_files/:/app/root_files:delegated
- ./wsgi/:/app/wsgi:delegated
# The production-grade Django container, run locally.
# Also draws from local .env file if available.
# Needs the release image build before you can use this,
# which is taken care of via the justfile
release-local:
depends_on:
- db
- redis
env_file: ./docker/envfiles/local.env
environment:
ALLOWED_HOSTS: "*"
DATABASE_URL: postgres://postgres:postgres@db/postgres
EMAIL_BACKEND: "django.core.mail.backends.console.EmailBackend"
REDIS_URL: redis://redis:6379
SECRET_KEY: "This is not the 53cr3t k3Y, this is just a tribute"
image: mozmeao/birdbox:${GIT_COMMIT:-latest}
ports:
- "8000:8000"
volumes:
- ./birdbox/:/app/birdbox:delegated
- ./bin/:/app/bin:delegated
- ./local-credentials/:/app/local-credentials:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./lib/:/app/lib:delegated
- ./root_files/:/app/root_files:delegated
- ./wsgi/:/app/wsgi:delegated
builder:
build:
context: .
target: python-builder
image: mozmeao/birdbox_build:${GIT_COMMIT:-latest}
platform: linux/amd64
db:
image: postgres:15-alpine
environment:
POSTGRES_PASSWORD: postgres
redis:
image: redis
# Support for executing housekeeping tasks on a local docker setup
compile-requirements:
image: mozmeao/birdbox_build:${GIT_COMMIT:-latest}
platform: linux/amd64
command:
./bin/compile-requirements.sh
volumes:
- .:/app