From 1fb1081af5779ca88e9420010997f1301f312a62 Mon Sep 17 00:00:00 2001 From: motahhari Date: Wed, 3 Jun 2026 03:20:16 +0330 Subject: [PATCH] fix deploy config --- Dockerfile | 17 +++++------------ docker-compose.yml | 29 +++++++++++++++++++++++++++++ nuget.config | 8 ++++++++ 3 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 docker-compose.yml create mode 100644 nuget.config diff --git a/Dockerfile b/Dockerfile index 31dad75..4430917 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,22 @@ -# مرحله 1: Build FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /app -# کپی فایل‌های پروژه به دایرکتوری کاری -COPY ["Complex.EndPoint/Complex.EndPoint.csproj", "Complex.EndPoint/"] +COPY nuget.config / +COPY Complex.EndPoint/Complex.EndPoint.csproj Complex.EndPoint/ +COPY Complex.Application/Complex.Application.csproj Complex.Application/ +COPY Complex.Domain/Complex.Domain.csproj Complex.Domain/ +COPY Complex.Infrastructure/Complex.Infrastructure.csproj Complex.Infrastructure/ -# بازیابی پکیج‌ها RUN dotnet restore "Complex.EndPoint/Complex.EndPoint.csproj" -# کپی بقیه کدهای پروژه COPY . . -# ساخت پروژه با حالت Release RUN dotnet publish "Complex.EndPoint/Complex.EndPoint.csproj" -c Release -o /app/publish -# مرحله 2: Runtime FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime WORKDIR /app -# کپی خروجی Publish از مرحله Build COPY --from=build /app/publish . EXPOSE 80 -# تعیین نقطه شروع کانتینر ENTRYPOINT ["dotnet", "Complex.EndPoint.dll"] - -# مشخص کردن پورت (اگر پروژه روی 80 یا 5000 است آن را تنظیم کن) - diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..94e3a7e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.8" + +services: + complex: + build: . + container_name: ComplexApi + environment: + - TZ=Asia/Tehran + - ASPNETCORE_ENVIRONMENT=Production + - ConnectionStrings__Default=Server=sqlserver,1433;TrustServerCertificate=True;Database=ComplexDb;User Id=sa;Password=qwER12#$110; + labels: + - "traefik.enable=true" + - "traefik.http.routers.complex.rule=Host(`complex.nabaksoft.ir`)" + - "traefik.http.services.complex.loadbalancer.server.port=80" + - "traefik.http.routers.complex.entrypoints=websecure" +# - "traefik.http.routers.webapp.tls.certresolver=letsencrypt" + - "traefik.http.routers.complex.middlewares=complex-cors@docker" + - "traefik.http.middlewares.complex-cors.headers.accessControlAllowMethods=GET,POST,PUT,DELETE,OPTIONS" + - "traefik.http.middlewares.complex-cors.headers.accessControlAllowHeaders=*" + - "traefik.http.middlewares.complex-cors.headers.accessControlAllowOriginList=https://*.nabaksoft.ir,http://192.168.8.108" + - "traefik.http.middlewares.webapp-cors.headers.accessControlAllowCredentials=true" + - "traefik.http.middlewares.complex-cors.headers.addVaryHeader=true" + networks: + - services + restart: unless-stopped + +networks: + services: + external: true diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..1b55218 --- /dev/null +++ b/nuget.config @@ -0,0 +1,8 @@ + + + + + + + +