-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
157 lines (148 loc) · 3.95 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
157 lines (148 loc) · 3.95 KB
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
services:
# Nginx Reverse Proxy - The single entry point for your app
# nginx:
# image: nginx:1.27-alpine
# container_name: bookapp-proxy-dev
# restart: always
# ports:
# # Maps host port 80 to nginx container port 80.
# # Change "80:80" to "8888:80" if port 80 is taken on your host.
# - "4353:80"
# volumes:
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
# depends_on:
# - backend
# - frontend
# networks:
# - internal
# SvelteKit Frontend Service - Development Mode
frontend:
image: node:lts-alpine3.22
container_name: bookapp-frontend-dev
working_dir: /app
restart: unless-stopped
environment:
PORT: 3000
HOST: 0.0.0.0
PUBLIC_API_URL: /api
API_INTERNAL_URL: http://backend:8080
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
- pnpm_store:/root/.local/share/pnpm/store
command: sh -c "npm i -g pnpm && pnpm install && pnpm dev --host 0.0.0.0 --port 3000"
ports:
- "3000:3000"
depends_on:
backend:
condition: service_started
networks:
- internal
backend:
image: golang:1.25-bookworm
container_name: bookapp-backend-dev
working_dir: /app
restart: unless-stopped
env_file:
- .env.local
volumes:
- ./backend:/app
- go-mod-cache:/go/pkg/mod
command: sh -c "go install github.com/air-verse/air@v1.64.0 && air"
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy
seaweedfs-filer:
condition: service_started
networks:
- internal
# PostgreSQL Database Service
db:
image: postgres:15
container_name: bookapp-db-dev
restart: always
env_file:
- .env.local
volumes:
# Mounts a named volume to the standard postgres data directory
- pgdata:/var/lib/postgresql/data
# Mounts the init script to run on first launch
- ./db-init:/docker-entrypoint-initdb.d
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
interval: 10s
timeout: 5s
retries: 10
networks:
- internal
# SeaweedFS Storage Services
seaweedfs-master:
image: chrislusf/seaweedfs:latest
container_name: bookapp-seaweedfs-master-dev
restart: always
command: master -ip=seaweedfs-master -port=9333
volumes:
- seaweedfs_master_data:/data
networks:
- internal
seaweedfs-volume:
image: chrislusf/seaweedfs:latest
container_name: bookapp-seaweedfs-volume-dev
restart: always
command: volume -mserver=seaweedfs-master:9333 -port=8080 -ip=seaweedfs-volume -dir=/data
depends_on:
- seaweedfs-master
volumes:
- seaweedfs_volume_data:/data
networks:
- internal
seaweedfs-filer:
image: chrislusf/seaweedfs:latest
container_name: bookapp-seaweedfs-filer-dev
restart: unless-stopped
command: filer -master=seaweedfs-master:9333 -port=8888 -ip=seaweedfs-filer -defaultStoreDir=/data
depends_on:
- seaweedfs-master
- seaweedfs-volume
volumes:
- seaweedfs_filer_data:/data
networks:
- internal
# Database Backup Service
db-backup:
image: postgres:15
container_name: bookapp-db-backup-dev
restart: always
depends_on:
db:
condition: service_healthy
env_file:
- .env.local
volumes:
- ./backups:/backups
entrypoint: >
sh -c "
mkdir -p /backups &&
while true; do
ts=$$(date +%F_%H%M);
pg_dump -h db -U $${PGUSER} $${PGDATABASE} > /backups/bookapp_backup_$${ts}.sql &&
echo \"[+] backup $${ts} done\" &&
find /backups -type f -mtime +7 -name '*.sql' -delete &&
sleep 24h;
done
"
networks:
- internal
volumes:
pgdata:
go-mod-cache:
frontend_node_modules:
pnpm_store:
seaweedfs_master_data:
seaweedfs_volume_data:
seaweedfs_filer_data:
networks:
internal:
driver: bridge