...
This commit is contained in:
@@ -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\
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"BaseAddress": "http://156.255.1.229:3201/api/",
|
||||
"BaseAddress": "https://service.moadiran.ir/api/",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
@@ -37,7 +37,15 @@
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
<script>navigator.serviceWorker.register('service-worker.js');</script>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/service-worker.js')
|
||||
.then(reg => console.log('Service Worker registered', reg))
|
||||
.catch(err => console.error('Service Worker registration failed:', err));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
Reference in New Issue
Block a user