-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.frontend.yml
More file actions
81 lines (79 loc) · 3.38 KB
/
docker-compose.frontend.yml
File metadata and controls
81 lines (79 loc) · 3.38 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
# Optional Docker Compose overlay: split-worker local development simulation
#
# This overlay adds a second wrangler dev service for the frontend Worker
# (adblock-frontend), mirroring the production split-worker topology
# where the frontend is a separate Cloudflare Worker connected to the backend
# via a Cloudflare service binding.
#
# For most development work, the default docker-compose.yml is sufficient —
# wrangler dev already emulates the service binding transparently in a single
# process. Use this overlay ONLY when you need to test the exact production
# split-worker architecture locally (e.g., validating service-binding
# behavior, frontend-worker-specific routing, or edge cases in the binding).
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.frontend.yml up
#
# The frontend worker will be available at http://localhost:${FRONTEND_PORT:-4200}
# (port 4200 matches the [dev].port configured in frontend/wrangler.toml)
services:
adblock-frontend:
image: jaysonknight/adblock-frontend:latest
build:
context: .
dockerfile: Dockerfile
# Use the runtime stage: it includes curl (for healthchecks), the
# wrangler binary (via root node_modules), and the built frontend/dist
# artifacts. The frontend-builder stage only produces the dist output
# and does not include wrangler.
target: runtime
container_name: adblock-frontend
ports:
- '${FRONTEND_PORT:-4200}:4200'
env_file:
- .env
- .env.${ENV:-development}
# Run wrangler dev for the frontend Worker using its own wrangler.toml.
# The runtime image already contains the built frontend/dist artifacts;
# the wrangler.toml is mounted below so the config is always current.
# Port 4200 matches [dev].port in frontend/wrangler.toml.
command:
[
'pnpm',
'exec',
'wrangler',
'dev',
'--config',
'frontend/wrangler.toml',
'--ip',
'0.0.0.0',
'--port',
'4200',
]
volumes:
# Mount frontend wrangler config so the correct Worker definition is used
- ./frontend/wrangler.toml:/app/frontend/wrangler.toml:ro
# Mount frontend source so it stays in sync with the image (e.g. for editors/tooling).
# Note: wrangler still serves built assets from /app/frontend/dist inside the container.
# To have host-side `ng build --watch` control the served assets, also mount:
# - ./frontend/dist:/app/frontend/dist
- ./frontend/src:/app/frontend/src
restart: unless-stopped
healthcheck:
# curl is installed in the runtime stage via apt-get.
# The frontend Angular SSR worker does not expose a /health route; probe /
# to verify the SSR entry point is responding.
test: ['CMD', 'curl', '-f', 'http://localhost:4200/']
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
depends_on:
adblock-compiler:
condition: service_healthy
networks:
- adblock-network
networks:
adblock-network:
name: adblock-compiler-network
driver: bridge