Feat dockerize
This commit is contained in:
@@ -30,6 +30,39 @@ npm run build
|
||||
npx serve out
|
||||
```
|
||||
|
||||
## دیپلوی پروداکشن با Docker
|
||||
|
||||
بیلد روی ماشین توسعه انجام میشود؛ خروجی `out/` داخل گیت commit میشود و روی سرور فقط image ساخته و اجرا میشود (بدون `npm install` / `npm run build` در سرور).
|
||||
|
||||
### روی سیستم توسعه (قبل از push)
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run build
|
||||
git add out Dockerfile nginx.conf docker-compose.yml
|
||||
git commit -m "build: ..."
|
||||
git push
|
||||
```
|
||||
|
||||
### روی سرور پروداکشن
|
||||
|
||||
```bash
|
||||
git pull
|
||||
docker compose build --no-cache
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
پیشفرض `docker-compose.yml` پورت **8080** را به کانتینر map میکند؛ در reverse proxy (مثلاً Traefik یا Nginx روی host) به `http://127.0.0.1:8080` اشاره کنید، یا پورت را در compose به `80:80` تغییر دهید.
|
||||
|
||||
بدون compose:
|
||||
|
||||
```bash
|
||||
docker build -t aria-imen-landing .
|
||||
docker run -d --name aria-imen-landing -p 8080:80 --restart unless-stopped aria-imen-landing
|
||||
```
|
||||
|
||||
تنظیمات Nginx داخل image مطابق export استاتیک Next.js است (`try_files`، کش `/_next/static/`، صفحه `404.html`).
|
||||
|
||||
## آپلود روی هاست (Static Hosting)
|
||||
|
||||
این پروژه با `output: 'export'` پیکربندی شده، یعنی:
|
||||
|
||||
Reference in New Issue
Block a user