-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
69 lines (66 loc) · 3.58 KB
/
docker-compose.yml
File metadata and controls
69 lines (66 loc) · 3.58 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
# ─────────────────────────────────────────────────────────────────────────────
# Production Docker Compose
# ─────────────────────────────────────────────────────────────────────────────
# Runs the backend and frontend as containers.
# Database and Redis are CLOUD-MANAGED — they are NOT included here.
# Set DATABASE_URL and REDIS_* in .env to point at your cloud services.
#
# Recommended cloud providers:
# MySQL/MariaDB: AWS RDS, PlanetScale, Railway, DigitalOcean Managed DB
# Redis: Upstash (https://upstash.com), Redis Cloud, Railway Redis
#
# ── Usage ──────────────────────────────────────────────────────────────────────
#
# Manual / VPS (builds from Dockerfile):
# docker compose up -d --build
#
# CI/CD (uses pre-built registry images — BACKEND_IMAGE and FRONTEND_IMAGE must be set):
# BACKEND_IMAGE=ghcr.io/you/app-backend:sha123 \
# FRONTEND_IMAGE=ghcr.io/you/app-frontend:sha123 \
# docker compose up -d --no-build
#
# For local development with local MySQL + Redis + Mailhog:
# docker compose -f docker-compose.dev.yml up -d
# ─────────────────────────────────────────────────────────────────────────────
services:
# ── Backend (Fastify API) ────────────────────────────────────────────────────
backend:
# BACKEND_IMAGE: set by CI/CD to the pre-built registry image (e.g. ghcr.io/you/app-backend:sha)
# Unset: Docker Compose builds from Dockerfile.backend instead.
image: ${BACKEND_IMAGE:-app-backend:local}
build:
context: .
dockerfile: Dockerfile.backend
restart: unless-stopped
env_file:
- path: .env
required: true
ports:
- "${PORT:-5000}:5000"
volumes:
# cdn volume is only needed when STORAGE_DRIVER=filesystem.
# Remove this volume if you are using STORAGE_DRIVER=s3 or cloudinary.
- cdn_data:/app/cdn
# ── Frontend (React SPA served by Nginx) ─────────────────────────────────────
frontend:
# FRONTEND_IMAGE: set by CI/CD to the pre-built registry image.
# Unset: Docker Compose builds from Dockerfile.frontend instead.
# Note: VITE_APP_URL is baked in at build time — staging and production
# must use separate images built with the correct VITE_APP_URL.
image: ${FRONTEND_IMAGE:-app-frontend:local}
build:
context: .
dockerfile: Dockerfile.frontend
args:
VITE_APP_URL: ${VITE_APP_URL}
VITE_APP_TITLE: ${APP_TITLE:-APP}
restart: unless-stopped
ports:
- "80:80"
depends_on:
- backend
# ── Named volumes ──────────────────────────────────────────────────────────────
volumes:
cdn_data:
# Optionally set a project-specific name to avoid collisions on shared hosts:
# name: "${COMPOSE_PROJECT_NAME:-app}_cdn_data"