fix deploy config

This commit is contained in:
motahhari
2026-06-03 23:41:55 +03:30
parent ec5eceec80
commit f790f38696
4 changed files with 20 additions and 37 deletions

View File

@@ -7,9 +7,11 @@ COPY ClientApp/ .
RUN npm run build
# Stage 2: Build the backend
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS backend-build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS backend-build
WORKDIR /src
COPY ["backend.csproj", "."]
COPY nuget.config ./
COPY backend.csproj ./
RUN dotnet nuget list source
RUN dotnet restore
COPY . .
# Copy the frontend build output from the previous stage
@@ -17,7 +19,7 @@ COPY --from=frontend-build /app/dist ./ClientApp/dist
RUN dotnet publish -c Release -o /app/publish
# Stage 3: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://+:8080

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<SpaRoot>ClientApp\</SpaRoot>

8
backend/nuget.config Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="iki" value="https://nuget.devneeds.ir/repository/nuget/index.json" />
</packageSources>
</configuration>

View File

@@ -1,27 +1,7 @@
version: "3.8"
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: ghadir-db
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=Ghadir@1403
- MSSQL_PID=Express
ports:
- "1433:1433"
volumes:
- sqlserver-data:/var/opt/mssql
networks:
- ghadir-network
healthcheck:
test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "Ghadir@1403" -C -Q "SELECT 1" || exit 1
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
backend:
ghadir_back:
build:
context: ./backend
dockerfile: Dockerfile
@@ -29,19 +9,12 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:8080
- ConnectionStrings__DefaultConnection=Server=sqlserver;Database=GhadirContestDB;User Id=sa;Password=Ghadir@1403;TrustServerCertificate=True
ports:
- "5000:8080"
depends_on:
sqlserver:
condition: service_healthy
- ConnectionStrings__DefaultConnection=Server=sqlserver,1433;TrustServerCertificate=True;Database=GhadirDb;User Id=sa;Password=qwER12#$110;
networks:
- ghadir-network
- services
restart: unless-stopped
networks:
ghadir-network:
driver: bridge
volumes:
sqlserver-data:
networks:
services:
external: true