Files
DiunaBI/DiunaBI.UI.Web/Dockerfile

48 lines
1.4 KiB
Docker
Raw Permalink Normal View History

2025-11-06 12:14:05 +01:00
# Stage 1: Build
2025-11-19 12:33:37 +01:00
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
2025-11-28 11:29:38 +01:00
WORKDIR /
2025-11-06 12:14:05 +01:00
# Copy solution and all project files for restore
COPY DiunaBI.sln ./
COPY DiunaBI.UI.Web/DiunaBI.UI.Web.csproj DiunaBI.UI.Web/
COPY DiunaBI.UI.Shared/DiunaBI.UI.Shared.csproj DiunaBI.UI.Shared/
COPY DiunaBI.Domain/DiunaBI.Domain.csproj DiunaBI.Domain/
COPY DiunaBI.Application/DiunaBI.Application.csproj DiunaBI.Application/
# Restore dependencies
RUN dotnet restore DiunaBI.UI.Web/DiunaBI.UI.Web.csproj
# Copy all source code
COPY . .
# Build and publish
2025-11-28 11:29:38 +01:00
WORKDIR /DiunaBI.UI.Web
2025-11-06 12:14:05 +01:00
RUN dotnet publish -c Release -o /app/publish --no-restore
# Stage 2: Runtime
2025-11-19 12:33:37 +01:00
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
2025-11-06 12:14:05 +01:00
WORKDIR /app
# Install wget for health checks
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
# Set timezone
ENV TZ=Europe/Warsaw
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Copy published files
COPY --from=build /app/publish .
# Set environment variables (can be overridden)
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://0.0.0.0:7143
# Expose port (default, can be remapped in docker-compose)
EXPOSE 7143
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:7143/health || exit 1
# Run the application
ENTRYPOINT ["dotnet", "DiunaBI.UI.Web.dll"]