Initial fullstack project setup with Next.js 15, Gin, PostgreSQL and Docker Compose
- Frontend: Next.js 15 (App Router), Auth.js v5, shadcn/ui, MagicUI - Backend: Go + Gin + GORM with layered architecture - Auth: Local credentials login with optional Keycloak OAuth binding - Admin: RBAC user management for admin role - Dev: Docker Compose with hot reload for both frontend and backend - Docker: 3-service orchestration (frontend, backend, postgres) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
71
docker-compose.yml
Normal file
71
docker-compose.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: evanpage-db
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-evan}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-evanpass}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-evanpage}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-evan} -d ${POSTGRES_DB:-evanpage}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- evanpage-net
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
target: dev
|
||||
container_name: evanpage-backend
|
||||
environment:
|
||||
DATABASE_URL: ${DATABASE_URL:-postgres://evan:evanpass@db:5432/evanpage?sslmode=disable}
|
||||
SERVER_PORT: ${SERVER_PORT:-8080}
|
||||
SERVER_API_URL: ${SERVER_API_URL:-http://backend:8080}
|
||||
AUTH_SECRET: ${AUTH_SECRET:-}
|
||||
AUTH_KEYCLOAK_ISSUER: ${AUTH_KEYCLOAK_ISSUER:-}
|
||||
AUTH_KEYCLOAK_ID: ${AUTH_KEYCLOAK_ID:-}
|
||||
AUTH_KEYCLOAK_SECRET: ${AUTH_KEYCLOAK_SECRET:-}
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
- /app/tmp
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- evanpage-net
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
container_name: evanpage-frontend
|
||||
environment:
|
||||
SERVER_API_URL: ${SERVER_API_URL:-http://backend:8080}
|
||||
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8080}
|
||||
AUTH_SECRET: ${AUTH_SECRET:-}
|
||||
AUTH_KEYCLOAK_ISSUER: ${AUTH_KEYCLOAK_ISSUER:-}
|
||||
AUTH_KEYCLOAK_ID: ${AUTH_KEYCLOAK_ID:-}
|
||||
AUTH_KEYCLOAK_SECRET: ${AUTH_KEYCLOAK_SECRET:-}
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- evanpage-net
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
|
||||
networks:
|
||||
evanpage-net:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user