Files
recipe-app/compose.yml
T
Nils-Johan Gynther ce0cc6fbf0 feat(auth): implement user authentication with JWT and NextAuth
- Added user registration and login functionality with JWT authentication.
- Created auth controller, service, and module in the backend.
- Implemented user model and user products management.
- Integrated NextAuth for session management on the frontend.
- Added middleware for protecting routes and handling public access.
- Updated frontend API routes to include authorization headers.
- Enhanced recipe and user product models to support ownership and visibility.
- Created registration and login pages in the frontend.
- Added necessary types for NextAuth session management.
2026-04-17 19:57:08 +02:00

93 lines
2.4 KiB
YAML

services:
recipe-frontend:
build:
context: ./frontend
dockerfile: Dockerfile
image: recipe-frontend:local
container_name: recipe-frontend
restart: unless-stopped
environment:
NODE_ENV: "production"
HOSTNAME: "0.0.0.0"
PORT: "3000"
NEXT_PUBLIC_APP_URL: "${NEXT_PUBLIC_APP_URL}"
NEXT_PUBLIC_API_URL: "${NEXT_PUBLIC_API_URL}"
NEXT_PUBLIC_API_URL_INTERNAL: "http://recipe-api:8080"
AUTH_SECRET: "${AUTH_SECRET}"
AUTH_URL: "${NEXT_PUBLIC_APP_URL}"
volumes:
- recipe_images:/app/public/images
depends_on:
recipe-api:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3000 >/dev/null 2>&1 || exit 1"]
interval: 20s
timeout: 10s
retries: 5
start_period: 40s
networks:
- proxy
- recipe-internal
recipe-api:
build:
context: ./backend
dockerfile: Dockerfile
image: recipe-api:local
container_name: recipe-api
restart: unless-stopped
environment:
NODE_ENV: "production"
DATABASE_URL: "mysql://root:${MARIADB_ROOT_PASSWORD}@recipe-db:3306/${MARIADB_DATABASE}"
MISTRAL_API_KEY: "${MISTRAL_API_KEY}"
JWT_SECRET: "${JWT_SECRET}"
volumes:
- recipe_images:/app/recipe-images
depends_on:
recipe-db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/api/health >/dev/null 2>&1 || exit 1"]
interval: 20s
timeout: 10s
retries: 10
start_period: 40s
networks:
- proxy
- recipe-internal
recipe-db:
image: mariadb:11
container_name: recipe-db
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
MARIADB_DATABASE: ${MARIADB_DATABASE}
MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
volumes:
- recipe_db_data:/var/lib/mysql
- ./db/init:/docker-entrypoint-initdb.d
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD-SHELL", "mariadb-admin ping -h 127.0.0.1 -uroot -p$$MARIADB_ROOT_PASSWORD >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- recipe-internal
volumes:
recipe_db_data:
recipe_images:
networks:
proxy:
external: true
recipe-internal:
driver: bridge