generated from nihalgonsalves/node-typescript-eslint-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
89 lines (84 loc) · 2.55 KB
/
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
services:
traefik:
depends_on:
- backend
- frontend
restart: unless-stopped
image: "traefik:v3.1"
command:
- --log.level=DEBUG
- --accesslog=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:8080
- --entrypoints.websecure-public.http.middlewares=default-headers@file
- --providers.file.directory=/config
- --providers.file.watch=true
ports:
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- ".env.htpasswd:/etc/traefik/.htpasswd"
- ./infra/traefik:/config
backend:
restart: unless-stopped
depends_on:
- postgres
- redis
build:
context: .
dockerfile: ./infra/Dockerfile-backend
init: true
# TODO: centralise/autogenerate this
# must contain DATABASE_URL, JWT_SECRET, VAPID_EMAIL, VAPID_PRIVATE_KEY, VAPID_PUBLIC_KEY, PUBLIC_ORIGIN, SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD
# optional SENTRY_DSN
env_file:
- .env.backend
environment:
PORT: 5174
FRANKFURTER_BASE_URL: https://api.frankfurter.app/
REDIS_URL: redis://redis:6379/
expose:
- 5174
labels:
traefik.enable: true
traefik.http.routers.backend.rule: Host(`localhost`) && PathPrefix(`/api`)
traefik.http.routers.backend.entrypoints: web
traefik.http.routers.backend.middlewares: backend-stripprefix
traefik.http.middlewares.backend-stripprefix.stripprefix.prefixes: /api
traefik.http.routers.admin.rule: Host(`localhost`) && PathPrefix(`/admin`)
traefik.http.routers.admin.entrypoints: web
traefik.http.routers.admin.middlewares: admin-auth
traefik.http.middlewares.admin-auth.basicauth.usersfile: /etc/traefik/.htpasswd
frontend:
restart: unless-stopped
build:
context: .
dockerfile: ./infra/Dockerfile-frontend
labels:
traefik.enable: true
traefik.http.routers.frontend.rule: Host(`localhost`)
traefik.http.routers.frontend.entrypoints: web
postgres:
restart: unless-stopped
image: postgres:17-alpine
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# must contain POSTGRES_PASSWORD
env_file:
- .env.postgres
volumes:
- postgres:/var/lib/postgresql/data
redis:
restart: unless-stopped
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres: