fix: fix bug docker

This commit is contained in:
2026-09-02 20:29:41 +03:30
parent c5bfa5544c
commit aeefe075dd
9 changed files with 118 additions and 65 deletions

View File

@@ -1,30 +1,60 @@
# React + TypeScript + Vite
# Persian Game frontend
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
رابط کاربری React + TypeScript این پروژه با Vite ساخته و در محیط production توسط Nginx سرو می‌شود.
Currently, two official plugins are available:
## اجرای Docker
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
پیش‌نیازها: Docker Engine و Docker Compose v2.
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level `parserOptions` property like this:
```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}
```bash
cp .env.example .env
docker compose up --detach --build
```
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
سپس برنامه روی `http://localhost:8080` در دسترس است. برای مشاهده وضعیت و لاگ‌ها:
```bash
docker compose ps
docker compose logs --follow web
```
برای توقف برنامه:
```bash
docker compose down
```
اسکریپت زیر نیز Compose را اعتبارسنجی، image را build و سرویس را اجرا می‌کند:
```bash
./build.sh
```
## تنظیمات
مقادیر قابل تنظیم در `.env`:
- `APP_PORT`: پورت میزبان؛ مقدار پیش‌فرض `8080` است.
- `VITE_API_URL`: آدرس کامل API؛ مقدار پیش‌فرض `https://api.persain-game.com/api/v1` است.
- `PERSIAN_GAME_IMAGE`: نام و tag ایمیج ساخته‌شده.
متغیر `VITE_API_URL` هنگام build داخل فایل‌های استاتیک قرار می‌گیرد. پس از تغییر آن باید image را دوباره build کنید:
```bash
docker compose build --no-cache web
docker compose up --detach web
```
## توسعه محلی بدون Docker
```bash
npm ci
npm run dev
```
بررسی production build و lint:
```bash
npm run build
npm run lint
```