Complete Next.js migration with SSR and Docker deployment
- Migrate from vanilla JavaScript SPA to Next.js 16 with App Router - Add server-side rendering for all pages (Home, Compare, Rankings) - Create individual school pages with dynamic routing (/school/[urn]) - Implement Chart.js and Leaflet map integrations - Add comprehensive SEO with sitemap, robots.txt, and JSON-LD - Set up Docker multi-service architecture (PostgreSQL, FastAPI, Next.js) - Update CI/CD pipeline to build both backend and frontend images - Fix Dockerfile to include devDependencies for TypeScript compilation - Add Jest testing configuration - Implement performance optimizations (code splitting, caching) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# PostgreSQL Database
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: schoolcompare_db
|
||||
@@ -10,6 +13,8 @@ services:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
networks:
|
||||
- schoolcompare-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U schoolcompare"]
|
||||
@@ -18,19 +23,24 @@ services:
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
app:
|
||||
build: .
|
||||
container_name: schoolcompare_app
|
||||
# FastAPI Backend
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: schoolcompare_backend
|
||||
ports:
|
||||
- "80:80"
|
||||
- "8000:80"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://schoolcompare:schoolcompare@db:5432/schoolcompare
|
||||
PYTHONUNBUFFERED: 1
|
||||
volumes:
|
||||
# Mount data directory for migrations
|
||||
- ./data:/app/data:ro
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- schoolcompare-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:80/api/data-info"]
|
||||
@@ -39,6 +49,35 @@ services:
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# Next.js Frontend
|
||||
nextjs:
|
||||
build:
|
||||
context: ./nextjs-app
|
||||
dockerfile: Dockerfile
|
||||
container_name: schoolcompare_nextjs
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
# Next.js can access backend via internal network
|
||||
NEXT_PUBLIC_API_URL: http://localhost:8000/api
|
||||
FASTAPI_URL: http://backend:80/api
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- schoolcompare-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
networks:
|
||||
schoolcompare-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user