-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathdocker-compose.yml
161 lines (149 loc) · 4.36 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
version: '3.7'
x-network:
&network
networks:
- smersh
x-cache-from:
- &api-cache-from
cache_from:
- ${NGINX_IMAGE:-quay.io/api-platform/nginx}
- ${PHP_IMAGE:-quay.io/api-platform/php}
services:
traefik:
image: traefik:v2.5
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.toml:/etc/traefik/traefik.toml
ports:
# Disable this dashboard in production
- 8080:8080
- 80:80
- 443:443
<<: *network
php:
build:
context: ./api
target: api_platform_php
<<: *api-cache-from
image: ${PHP_IMAGE:-quay.io/api-platform/php}
healthcheck:
interval: 10s
timeout: 3s
retries: 3
start_period: 30s
environment:
- APP_ENV=${APP_ENV}
- DOMAIN=${TRANSPORT}${DOMAIN}
- TRUSTED_HOSTS=^((${SUBDOMAINS}\.)?${DOMAIN})|api$$
- CORS_ALLOW_ORIGIN=^${TRANSPORT}(${SUBDOMAINS}.)?${DOMAIN}$$
- DATABASE_URL=postgres://${API_DB_USER}:${API_DB_PASS}@db/${API_DB_NAME}
- JWT_PASSPHRASE=${JWT_KEY}
- BASE_URL=${TRANSPORT}${DOMAIN}
depends_on:
- db
- codimd
volumes:
- ./api:/srv/api:rw,cached
- ./api/docker/php/conf.d/api-platform.dev.ini:/usr/local/etc/php/conf.d/api-platform.ini
# if you develop on Linux, you may use a bind-mounted host directory instead
# - ./api/var:/srv/api/var:rw
<<: *network
api:
build:
context: ./api
target: api_platform_nginx
<<: *api-cache-from
image: ${NGINX_IMAGE:-quay.io/api-platform/nginx}
depends_on:
- traefik
- php
expose:
- 80
volumes:
- ./api/public:/srv/api/public:ro
labels:
- traefik.http.routers.api.rule=Host(`api.${DOMAIN}`)
- traefik.http.routers.api.tls=true
- traefik.http.routers.api.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.api.tls.domains[0].sans=*.${DOMAIN}
<<: *network
db:
image: postgres:12-alpine
environment:
- POSTGRES_DB=${API_DB_NAME}
- POSTGRES_PASSWORD=${API_DB_PASS}
- POSTGRES_USER=${API_DB_USER}
volumes:
- db-data:/var/lib/postgresql/data:rw
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./api/docker/db/data:/var/lib/postgresql/data:rw
# Uncomment to expose db
# ports:
# - target: 5432
# published: 5432
# protocol: tcp
<<: *network
db_codimd:
image: postgres:12-alpine
environment:
- POSTGRES_DB=${CODI_DB_NAME}
- POSTGRES_PASSWORD=${CODI_DB_PASS}
- POSTGRES_USER=${CODI_DB_USER}
volumes:
- db-codimd-data:/var/lib/postgresql/data
# restart: always
<<: *network
codimd:
image: nabo.codimd.dev/hackmdio/hackmd:latest
environment:
- CMD_DB_URL=postgres://${CODI_DB_USER}:${CODI_DB_PASS}@db_codimd/${CODI_DB_NAME}
- CMD_USECDN=false
depends_on:
- db_codimd
expose:
- 3000
labels:
- traefik.http.routers.codimd.rule=Host(`codimd.${DOMAIN}`)
- traefik.http.services.codimd.loadbalancer.server.port=3000
- traefik.http.routers.codimd.tls=true
- traefik.http.routers.codimd.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.codimd.tls.domains[0].sans=*.${DOMAIN}
volumes:
- upload-data:/home/hackmd/app/public/uploads
# restart: always
<<: *network
client:
build:
context: ./client
args:
TRANSPORT: ${TRANSPORT}
API_BASE_URL: api.${DOMAIN}
image: node:latest
environment:
- PATH=/app/node_modules/.bin:$PATH
expose:
- 80
labels:
- traefik.http.routers.client.rule=Host(`${DOMAIN}`)
- traefik.http.routers.client.tls=true
- traefik.http.routers.client.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.client.tls.domains[0].sans=*.${DOMAIN}
<<: *network
bitwarden:
image: bitwardenrs/server:latest
labels:
- traefik.http.routers.bitwarden.rule=Host(`bitwarden.${DOMAIN}`)
- traefik.http.routers.bitwarden.tls=true
- traefik.http.routers.bitwarden.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.bitwarden.tls.domains[0].sans=*.${DOMAIN}
volumes:
- ./data/bitwarden:/data
# restart: on-failure
<<: *network
volumes:
db-data: {}
db-codimd-data: {}
upload-data: {}
networks:
smersh:
external: true