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
name: preview-demo
services:
web:
image: nginx:1.27
ports:
- "8080:80"
depends_on:
db:
condition: service_healthy
volumes:
- web-assets:/usr/share/nginx/html:ro
networks:
- frontend
secrets:
- app_token
command: ["/bin/sh", "-c", "echo very-secret"]
db:
build:
context: ./database
dockerfile: Dockerfile
expose:
- "5432"
volumes:
- db-data:/var/lib/postgresql/data
networks:
- backend
secrets:
- db_password
environment:
POSTGRES_PASSWORD: super-secret-value
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
volumes:
web-assets: {}
db-data:
driver: local
networks:
frontend: {}
backend: {}
secrets:
app_token:
file: ./secrets/app-token.txt
db_password:
environment: POSTGRES_PASSWORD
configs:
nginx_config:
file: ./nginx.conf