forked from belgattitude/nextjs-monorepo-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.nextjs-app.yml
82 lines (77 loc) · 2.32 KB
/
docker-compose.nextjs-app.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
name: nextjs-monorepo-example-nextjs-app
services:
# Start web-app in development
# docker-compose -f docker-compose.yml -f docker-compose.web-app.yml up main-db develop
develop:
container_name: nextjs-app-develop
profiles:
- donotstart
stdin_open: true
environment:
PORT: ${NEXTJS_APP_PORT:-3000}
ports:
- target: ${NEXTJS_APP_PORT:-3000}
published: ${NEXTJS_APP_PORT:-3000}
protocol: tcp
- target: ${NEXTJS_APP_PORT:-3000}
published: ${NEXTJS_APP_PORT:-3000}
protocol: udp
build:
context: .
dockerfile: Dockerfile
target: develop
args:
USER_ID: ${USER_ID:-1000}
GROUP_ID: ${GROUP_ID:-1000}
volumes:
# Share the source code to allow development
- .:/app/
# Prevent sharing of node_modules between host and container
# to avoid ownership and/or platform issues
- build_nextjs-app:/app/apps/nextjs-app/.next
- nm_nextjs-app:/app/node_modules
- nm_prisma:/app/packages/db-main-prisma/node_modules
# Convenience production "deps" stage service for debugging
# Build > docker buildx bake -f docker-compose.web-app.yml --progress=tty deps
deps:
container_name: nextjs-app-multistage-deps
profiles:
- donotstart
stdin_open: true
build:
context: .
dockerfile: Dockerfile
target: deps
# Convenience production "builder" stage service for debugging
# Build > docker buildx bake -f docker-compose.nextjs-app.yml --progress=tty runner
builder:
container_name: nextjs-app-multistage-builder
profiles:
- donotstart
stdin_open: true
build:
context: .
dockerfile: Dockerfile
target: builder
# Convenience production "runner" stage service for debugging
# Build > docker buildx bake -f docker-compose.nextjs-app.yml --progress=tty runner
# Run > docker-compose -f docker-compose.nextjs-app.yml --env-file ./apps/nextjs-app/.env.local up runner
runner:
container_name: nextjs-app-multistage-runner
profiles:
- donotstart
stdin_open: true
ports:
- target: 3000
published: 3000
protocol: tcp
build:
context: .
dockerfile: Dockerfile
target: runner
environment:
- PRISMA_DATABASE_URL
volumes:
build_nextjs-app:
nm_nextjs-app:
nm_prisma: