From 93dcaa65f0406b465e60d093ecfafb90cf16163d Mon Sep 17 00:00:00 2001
From: mmrbnjd
Date: Sat, 18 Oct 2025 18:04:58 +0330
Subject: [PATCH] ...
---
Back/Program.cs | 8 ++--
Back/appsettings.Development.json | 17 --------
Back/appsettings.production.json | 17 --------
TaxPayerFull/Dockerfile | 57 +++++++++------------------
TaxPayerFull/wwwroot/appsettings.json | 2 +-
TaxPayerFull/wwwroot/index.html | 10 ++++-
moadiran/Pages/BlogDetails.razor | 4 +-
moadiran/Pages/Home.razor | 8 ++--
moadiran/Pages/ListBlog.razor | 4 +-
moadiran/wwwroot/robots.txt | 2 +-
10 files changed, 40 insertions(+), 89 deletions(-)
delete mode 100644 Back/appsettings.Development.json
delete mode 100644 Back/appsettings.production.json
diff --git a/Back/Program.cs b/Back/Program.cs
index 7ca73db..355e365 100644
--- a/Back/Program.cs
+++ b/Back/Program.cs
@@ -104,11 +104,9 @@ builder.Services.AddCors(options =>
options.AddPolicy(origins,
policy =>
{
- policy.AllowAnyOrigin()
- //.WithOrigins("https://localhost:7224", "http://localhost:5107"
- // , "http://195.88.208.142", "http://moadiran.ir"
- // , "https://195.88.208.142", "http://156.255.1.229:3101"
- //, "https://195.88.208.142:440", "http://156.255.1.229:3101:440", "https://localhost:44346")
+ policy
+ //.AllowAnyOrigin()
+ .WithOrigins("https://app.moadiran.ir", "https://moadiran.ir", "http://156.255.1.229:3101", "http://156.255.1.229:3102/")
.AllowAnyHeader()
.WithHeaders(HeaderNames.ContentType)
.AllowAnyMethod();
diff --git a/Back/appsettings.Development.json b/Back/appsettings.Development.json
deleted file mode 100644
index 50fd7d1..0000000
--- a/Back/appsettings.Development.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
- "ConnectionStrings": {
- "Base": "Data Source=195.88.208.142;Initial Catalog=TaxPayer020713;User ID=sa;Password=M439610m@;TrustServerCertificate=True"
-
- },
- "Fixedvalues": {
- "Jwt_Lifetime_Minutes": "144000"
- },
- "CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
- "ReportLog": "E:\\Report\\log.txt"
-}
diff --git a/Back/appsettings.production.json b/Back/appsettings.production.json
deleted file mode 100644
index 12f55f5..0000000
--- a/Back/appsettings.production.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
- "ConnectionStrings": {
- "Base": "Data Source=.;Initial Catalog=TaxPayer020713;User ID=sa;Password=M439610m@;TrustServerCertificate=True"
-
- },
- "Fixedvalues": {
- "Jwt_Lifetime_Minutes": "144000"
- },
- "CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
- "ReportLog": "E:\\Report\\log.txt"
-}
diff --git a/TaxPayerFull/Dockerfile b/TaxPayerFull/Dockerfile
index ec6859a..0edf158 100644
--- a/TaxPayerFull/Dockerfile
+++ b/TaxPayerFull/Dockerfile
@@ -1,86 +1,65 @@
-# مرحله ۱: Build پروژه Blazor WASM با .NET 9
-# اینجا باید از SDK استفاده کنید نه aspnet
+# مرحله ۱: Build با caching بهتر
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
-# نصب وابستگیها برای emscripten (python3 + سایر ابزارها)
+# نصب dependencyها (apt-get) در یک layer
RUN apt-get update && apt-get install -y python3 make cmake clang zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
-# کپی کردن فایلهای پروژه
+# کپی csprojها جداگانه برای cache بهتر
COPY TaxPayerFull/Front.csproj Front/
COPY Shared/Shared.csproj Shared/
-COPY . .
-# پاکسازی workloadهای قدیمی (اختیاری)
-RUN dotnet workload clean
-
-# نصب wasm-tools برای Blazor
+# نصب wasm-tools (فقط اگر تغییر کند cache میماند)
RUN dotnet workload install wasm-tools
-# انتشار (Publish) خروجی در حالت Release
+# restore تنها بر اساس csprojها
+RUN dotnet restore Front/Front.csproj
+
+# کپی باقی پروژه
+COPY TaxPayerFull/. TaxPayerFull/
+COPY Shared/. Shared/
+
+# انتشار Blazor WASM
RUN dotnet publish "TaxPayerFull/Front.csproj" -c Release -o /app \
-p:TreatWarningsAsErrors=false \
-p:RunAOTCompilation=false \
-p:PublishTrimmed=false
-# مرحله ۲: سرو کردن با Nginx
+# مرحله ۲: Nginx
FROM nginx:alpine AS final
WORKDIR /usr/share/nginx/html
-
-# حذف محتوای پیشفرض nginx
RUN rm -rf ./*
-# کپی خروجی Blazor WASM
COPY --from=build /app/wwwroot ./
-# فقط بلوک server داخل default.conf
+# کانفیگ Nginx
RUN printf 'server {\n\
listen 5107;\n\
server_name localhost;\n\
-\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
\n\
location / {\n\
try_files $uri $uri/ /index.html;\n\
}\n\
-
\n\
location /_framework/ {\n\
expires 1y;\n\
add_header Cache-Control "public, immutable";\n\
}\n\
-\n\
location /_content/ {\n\
expires 1y;\n\
add_header Cache-Control "public, immutable";\n\
}\n\
-\n\
location /assets/ {\n\
expires 7d;\n\
add_header Cache-Control "public";\n\
}\n\
- \n\
- location /css/ {\n\
- expires 7d;\n\
- add_header Cache-Control "public";\n\
- }\n\
- \n\
- location /fonts/ {\n\
- expires 7d;\n\
- add_header Cache-Control "public";\n\
- }\n\
- \n\
- location /img/ {\n\
- expires 7d;\n\
- add_header Cache-Control "public";\n\
- }\n\
- \n\
- location /js/ {\n\
- expires 7d;\n\
- add_header Cache-Control "public";\n\
- }\n\
+ location /css/ { expires 7d; add_header Cache-Control "public"; }\n\
+ location /fonts/ { expires 7d; add_header Cache-Control "public"; }\n\
+ location /img/ { expires 7d; add_header Cache-Control "public"; }\n\
+ location /js/ { expires 7d; add_header Cache-Control "public"; }\n\
\n\
location ~ \\.dll$ { add_header Content-Type application/octet-stream; }\n\
location ~ \\.wasm$ { add_header Content-Type application/wasm; }\n\
diff --git a/TaxPayerFull/wwwroot/appsettings.json b/TaxPayerFull/wwwroot/appsettings.json
index 478c7e7..3cb2a93 100644
--- a/TaxPayerFull/wwwroot/appsettings.json
+++ b/TaxPayerFull/wwwroot/appsettings.json
@@ -1,5 +1,5 @@
{
- "BaseAddress": "http://156.255.1.229:3201/api/",
+ "BaseAddress": "https://service.moadiran.ir/api/",
"Logging": {
"LogLevel": {
"Default": "Information",
diff --git a/TaxPayerFull/wwwroot/index.html b/TaxPayerFull/wwwroot/index.html
index cbe0660..f8d760b 100644
--- a/TaxPayerFull/wwwroot/index.html
+++ b/TaxPayerFull/wwwroot/index.html
@@ -37,7 +37,15 @@
🗙
-
+
diff --git a/moadiran/Pages/BlogDetails.razor b/moadiran/Pages/BlogDetails.razor
index 972b74f..09a95b0 100644
--- a/moadiran/Pages/BlogDetails.razor
+++ b/moadiran/Pages/BlogDetails.razor
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/moadiran/Pages/Home.razor b/moadiran/Pages/Home.razor
index 1d6d13f..eb39381 100644
--- a/moadiran/Pages/Home.razor
+++ b/moadiran/Pages/Home.razor
@@ -9,7 +9,7 @@
-
+
@@ -56,7 +56,7 @@
مدیریت صورتحساب ها و ارسال به سامانه مودیان
-
+
شروع کنید
@@ -221,7 +221,7 @@
-
+
شروع کنید
@@ -351,7 +351,7 @@
راه حلی برای مدیریت بهتر صورتحساب ها
-
+
شروع کنید
diff --git a/moadiran/Pages/ListBlog.razor b/moadiran/Pages/ListBlog.razor
index 31979ad..70d616a 100644
--- a/moadiran/Pages/ListBlog.razor
+++ b/moadiran/Pages/ListBlog.razor
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/moadiran/wwwroot/robots.txt b/moadiran/wwwroot/robots.txt
index 8a92896..1c4ed52 100644
--- a/moadiran/wwwroot/robots.txt
+++ b/moadiran/wwwroot/robots.txt
@@ -2,4 +2,4 @@
Allow: /
User-Agent: *
-DisAllow : http://156.255.1.229:3102/Sign-in
\ No newline at end of file
+DisAllow : https://app.moadiran.ir/Sign-in
\ No newline at end of file