Add Drupal headless stack with Next.js frontend

- Add Next.js frontend service (nextjs) with Dockerfile and source
- Update docker-compose.yml: image names, Drupal 11.3.3, nextjs service
- Add docker-compose.override.yml.disabled for dev hot-reload
- Add install-headless-modules.sh for OAuth/JSON:API module setup
- Add README.md with full setup and configuration guide
- Update nginx/Dockerfile and nginx.conf.template for cms. subdomain
- Update drupal/Dockerfile PHP-FPM build args
- Gitignore **/.vscode/ to prevent IDE workspace files from being tracked
This commit is contained in:
rnsrk 2026-03-30 11:14:17 +02:00
parent 71a8dac389
commit f8b8f53d54
85 changed files with 7802 additions and 17 deletions

View file

@ -1,6 +1,7 @@
services:
# Drupal CMS NGINX reverse proxy (cms.nasarek.dev).
nginx:
image: drupal-nginx
image: rnsrk/drupal-nginx
build:
context: ./nginx
dockerfile: Dockerfile
@ -10,7 +11,7 @@ services:
labels:
- traefik.enable=true
- traefik.docker.network=traefik
- traefik.http.routers.drupal-reverse-proxy.rule=Host(`${DOMAIN}`)
- traefik.http.routers.drupal-reverse-proxy.rule=Host(`cms.${DOMAIN}`)
- traefik.http.routers.drupal-reverse-proxy.entrypoints=web,websecure
- traefik.http.routers.drupal-reverse-proxy.middlewares=https-redirect
- traefik.http.routers.drupal-reverse-proxy.tls=true
@ -22,13 +23,14 @@ services:
- traefik
- drupal
# Drupal PHP-FPM backend.
drupal-fpm:
image: drupal-php8-4-fpm-bookworm
image: rnsrk/drupal-php8-4-fpm-bookworm
build:
context: ./drupal
dockerfile: Dockerfile
args:
DRUPAL_VERSION: ${DRUPAL_VERSION:-11.1.6}
DRUPAL_VERSION: ${DRUPAL_VERSION:-11.3.3}
labels:
- traefik.enable=false
container_name: drupal-fpm
@ -40,12 +42,11 @@ services:
- database
- drupal
# Redis cache backend.
redis:
image: redis:7-alpine
container_name: drupal-redis
command: redis-server --loglevel warning
environment:
- OVERC
volumes:
- redis-data:/data
networks:
@ -57,6 +58,37 @@ services:
retries: 5
start_period: 10s
# Next.js frontend (nasarek.dev).
nextjs:
image: rnsrk/nextjs-frontend
build:
context: ./nextjs
dockerfile: Dockerfile
args:
NEXT_PUBLIC_DRUPAL_BASE_URL: https://cms.${DOMAIN}
DRUPAL_CLIENT_ID: ${DRUPAL_CLIENT_ID}
DRUPAL_CLIENT_SECRET: ${DRUPAL_CLIENT_SECRET}
DRUPAL_OAUTH_SCOPE: ${DRUPAL_OAUTH_SCOPE:-}
container_name: nextjs-frontend
labels:
- traefik.enable=true
- traefik.docker.network=traefik
- traefik.http.routers.nextjs-frontend.rule=Host(`${DOMAIN}`)
- traefik.http.routers.nextjs-frontend.entrypoints=web,websecure
- traefik.http.routers.nextjs-frontend.middlewares=https-redirect
- traefik.http.routers.nextjs-frontend.tls=true
- traefik.http.routers.nextjs-frontend.tls.certresolver=le
- traefik.http.services.nextjs-frontend.loadbalancer.server.port=3000
env_file:
- ./nextjs/.env.local
networks:
- traefik
- drupal
depends_on:
- drupal-fpm
restart: unless-stopped
volumes:
redis-data:
name: drupal-redis-data