Files
next-dj/DOCKER.md
Beyhan Oğur e881f38e4e first commit
2026-04-26 22:12:36 +03:00

55 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Docker (Next.js + NextAuth)
Bu repo **Node.js 24.12.0** ve **Yarn 1.22.22** ile Dockerize edilmiştir.
## Gereksinimler
- Docker Desktop
## Ortam Değişkenleri (ENV)
Repo kökünde `.env.local` oluşturun:
- Örnek: `env.example.txt`
- Kritik değişkenler:
- `NEXTAUTH_URL`
- `NEXTAUTH_SECRET`
- `NEXT_PUBLIC_API_BASE_URL`
> Not: `.env*` dosyaları `.dockerignore` ile image içine kopyalanmaz. Compose veya `--env-file` ile verilir.
## Prod (multi-stage)
Image build:
```bash
docker build -t next-dj:prod --target runner .
```
Container run:
```bash
docker run --rm -p 3000:3000 --env-file .env.local next-dj:prod
```
## Dev (hot reload)
```bash
docker compose up --build web-dev
```
- Kod değişiklikleri otomatik yansır.
- `node_modules` ve `.next` cache için named volume kullanılır.
## Compose ile prod
```bash
docker compose up --build web-prod
```
## Sık karşılaşılabilecek sorunlar
- **Backend URL**: Docker içinde `NEXT_PUBLIC_API_BASE_URL`, `localhost` yerine container ağından erişilebilir bir host olmalı.
- Backend de compose'ta ise çoğunlukla: `http://backend:8000/api/v1`
- **NEXTAUTH_URL**: Prod'da gerçek domaininizi yazın.