fixes
All checks were successful
SonarQube / Build and analyze (push) Successful in 2m57s

This commit is contained in:
Leonid Pershin
2025-10-22 03:28:48 +03:00
parent 1996fec14f
commit 0e5c418a0e
8 changed files with 492 additions and 64 deletions

42
ChatBot/Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copy project file
COPY ChatBot.csproj ./
# Restore dependencies
RUN dotnet restore
# Copy all source files
COPY . .
# Build the application
RUN dotnet build -c Release -o /app/build
# Publish stage
FROM build AS publish
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
# Install PostgreSQL client for healthcheck (optional)
RUN apt-get update && apt-get install -y postgresql-client && rm -rf /var/lib/apt/lists/*
# Copy published application
COPY --from=publish /app/publish .
# Create directory for logs
RUN mkdir -p /app/logs && chmod 777 /app/logs
# Expose ports (if needed for health checks or metrics)
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD dotnet ChatBot.dll --health-check || exit 1
# Run the application
ENTRYPOINT ["dotnet", "ChatBot.dll"]