-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
93 lines (89 loc) · 2.56 KB
/
docker-compose.yml
File metadata and controls
93 lines (89 loc) · 2.56 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
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./docker/nginx/nginx.vhost.dev.conf.template:/etc/nginx/conf.d/nginx.vhost.dev.conf.template:ro
- ./docker/nginx/nginx.vhost.prod.conf.template:/etc/nginx/conf.d/nginx.vhost.prod.conf.template:ro
- ./docker/nginx/nginx-entrypoint.sh:/nginx-entrypoint.sh
entrypoint: ["sh", "-c", "chmod +x /nginx-entrypoint.sh && exec /nginx-entrypoint.sh"]
depends_on:
- frontend
- backend
networks:
- mangareader
environment:
- VHOST_DOMAIN=${VHOST_DOMAIN}
- FRONTEND_PORT=${FRONTEND_PORT}
- BACKEND_PORT=${BACKEND_PORT}
- APP_ENV=${APP_ENV}
# Frontend service - builds for production or runs dev server
frontend:
build:
context: ./frontend
dockerfile: ../Dockerfile.frontend
target: builder
ports:
- "${FRONTEND_PORT:-5173}:${FRONTEND_PORT:-5173}"
volumes:
- frontend-dist:/app/dist
- ./frontend:/app:cached
- /app/node_modules
environment:
- NODE_ENV=${APP_ENV:-production}
- APP_ENV=${APP_ENV:-production}
- FRONTEND_PORT=${FRONTEND_PORT:-5173}
- BACKEND_PORT=${BACKEND_PORT:-3000}
command: >
sh -c "
if [ \"$$APP_ENV\" = \"development\" ]; then
npm run dev -- --host 0.0.0.0;
else
npm run build && echo 'Frontend built successfully';
fi
"
networks:
- mangareader
# Backend service - serves API and frontend
backend:
build:
context: ./backend
dockerfile: ../Dockerfile.backend
args:
- BACKEND_PORT=${BACKEND_PORT:-3000}
ports:
- "${BACKEND_PORT:-3000}:${BACKEND_PORT:-3000}"
environment:
- NODE_ENV=${APP_ENV:-production}
- APP_ENV=${APP_ENV:-development}
- PORT=${BACKEND_PORT:-3000}
- DATABASE_URL=file:/data/dev.db
- MANGA_STORAGE_PATH=/manga
volumes:
- frontend-dist:/app/frontend/dist:ro
- backend-data:/data
- ./storage/images:/app/images
- ${MANGA_STORAGE_PATH:-/mnt/d/Manhwa}:/manga:ro
- ./backend/src:/app/src:cached
- ./backend/prisma:/app/prisma:cached
depends_on:
- frontend
restart: unless-stopped
command: >
sh -c "
npx prisma migrate deploy &&
if [ \"$$APP_ENV\" = \"development\" ]; then
npx nodemon --exec tsx --watch src src/index.ts;
else
node dist/index.js;
fi
"
networks:
- mangareader
volumes:
frontend-dist:
backend-data:
networks:
mangareader:
driver: bridge