generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
98 lines (93 loc) · 2.62 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
services:
db:
image: "postgres:16"
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: grafana
ports:
- "6543:5432"
volumes:
- postgres:/var/lib/postgresql/data/
grafana:
# use Dockerfile so that version matches production
build:
dockerfile: grafana/Dockerfile
environment:
GF_DATABASE_TYPE: postgres
GF_DATABASE_HOST: db:5432
GF_DATABASE_NAME: grafana
GF_DATABASE_USER: user
GF_DATABASE_PASSWORD: pass
GF_DATABASE_SSL_MODE: disable
depends_on:
- db
- timescaledb
ports:
- 3000:3000
volumes:
- grafana:/var/lib/grafana
timescaledb:
build:
dockerfile: timescaledb/Dockerfile
environment:
POSTGRES_DB: metrics
POSTGRES_PASSWORD: pass
POSTGRES_USER: user
ports:
- 5433:5432
volumes:
- timescaledb:/home/postgres/pgdata/data
metrics-prod:
# image name, both locally and public
image: metrics
build:
dockerfile: docker/Dockerfile
# the prod stage in the Dockerfile
target: metrics-prod
# should speed up the build in CI, where we have a cold cache
cache_from: # should speed up the build in CI, where we have a cold cache
- ghcr.io/opensafely-core/base-docker
- ghcr.io/ebmdatalab/metrics
args:
# this makes the image work for later cache_from: usage
- BUILDKIT_INLINE_CACHE=1
# env vars should be supplied by just
- BUILD_DATE
- GITREF
# use dockers builitin PID daemon
init: true
environment:
- SLACK_SIGNING_SECRET=dummy
- SLACK_TECH_SUPPORT_CHANNEL_ID=dummy
- SLACK_TOKEN=dummy
- TIMESCALEDB_URL=dummy
# main development service
metrics-dev:
extends:
service: metrics-prod
image: metrics-dev
build:
# the dev stage in the Dockerfile
target: metrics-dev
# pass the uid/gid as build arg
args:
- DEV_USERID=${DEV_USERID:-1000}
- DEV_GROUPID=${DEV_GROUPID:-1000}
container_name: metrics-dev
# running as a specific uid/gid allows files written to mounted volumes by
# the docker container's default user to match the host user's uid/gid, for
# convienience.
user: ${DEV_USERID:-1000}:${DEV_GROUPID:-1000}
volumes:
# mount our current code
- .:/app
environment:
- SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET:-}
- SLACK_TECH_SUPPORT_CHANNEL_ID=${SLACK_TECH_SUPPORT_CHANNEL_ID:-}
- SLACK_TOKEN=${SLACK_TOKEN:-}
- TIMESCALEDB_URL=${TIMESCALEDB_URL:-}
volumes:
postgres:
grafana:
timescaledb: