-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
98 lines (94 loc) · 4.04 KB
/
docker-compose.yml
File metadata and controls
98 lines (94 loc) · 4.04 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
# ⚠️ DEPRECATION NOTICE (2026-03-25)
# The PostgreSQL service in this file is NO LONGER USED for local development.
# Neon branching now serves as both the production and developer database.
# Create a personal dev branch at https://console.neon.tech → your project → Branches → New Branch,
# then set the branch connection string in .dev.vars and .env.local.
# See docs/database-setup/local-dev.md for the current Neon branching workflow.
#
# This file is retained in case it is needed for other tooling (CI image builds,
# the adblock-compiler container service, etc.). The `postgres` service within it
# should be considered deprecated and will be removed in a future cleanup PR.
# ─────────────────────────────────────────────────────────────────────────────
services:
# Main adblock-compiler backend Worker service (wrangler dev).
# NOTE: The frontend is NOT a separate container here. In production the
# frontend runs as a separate Cloudflare Worker (adblock-frontend)
# connected to this backend via a Cloudflare service binding. Locally,
# `wrangler dev` emulates that service binding transparently, so no
# separate frontend container is needed for everyday development.
# To simulate the exact split-worker production topology locally, use the
# optional overlay: docker compose -f docker-compose.yml -f docker-compose.frontend.yml up
adblock-compiler:
image: jaysonknight/adblock-compiler:latest
build:
context: .
dockerfile: Dockerfile
target: runtime
container_name: adblock-compiler
ports:
- '${PORT:-8787}:8787'
env_file:
# Load environment variables in layered order
- .env # Base configuration
- .env.${ENV:-development} # Environment-specific (development by default)
# .env.local is excluded from Docker builds (in .dockerignore)
# Pass secrets via docker-compose.override.yml or -e flags
environment:
# Override/add any environment-specific variables here
- DENO_DIR=/app/.deno
volumes:
# Persist Deno cache
- deno-cache:/app/.deno
restart: unless-stopped
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8787/health']
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
networks:
- adblock-network
postgres:
image: postgres:16-alpine
ports:
- '${POSTGRES_PORT:-5432}:5432'
environment:
POSTGRES_DB: adblock_dev
POSTGRES_USER: adblock
POSTGRES_PASSWORD: localdev
volumes:
- pgdata:/var/lib/postgresql/data
- ./scripts/docker-init-db.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U adblock -d adblock_dev']
interval: 5s
timeout: 5s
retries: 5
networks:
- adblock-network
# One-shot migration runner — exits 0 after migrations succeed.
# Usage: docker compose up postgres db-migrate
db-migrate:
image: denoland/deno:2.3.3
working_dir: /app
volumes:
- .:/app
- deno-cache:/deno-dir
environment:
DENO_DIR: /deno-dir
DATABASE_URL: postgresql://adblock:localdev@postgres:5432/adblock_dev
DIRECT_DATABASE_URL: postgresql://adblock:localdev@postgres:5432/adblock_dev
depends_on:
postgres:
condition: service_healthy
entrypoint: ['deno', 'run', '-A', '--env=.env.local', 'npm:prisma', 'migrate', 'deploy']
networks:
- adblock-network
volumes:
deno-cache:
name: adblock-compiler-deno-cache
pgdata:
networks:
adblock-network:
name: adblock-compiler-network
driver: bridge