Files
DiunaBI/DiunaBI.API/Dockerfile
Michał Zieliński bf2beda390
All checks were successful
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m41s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m36s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Successful in 1m49s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Successful in 1m48s
build fix2
2025-12-04 18:44:39 +01:00

59 lines
1.8 KiB
Docker

# Stage 1: Build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG PLUGIN_PROJECT=DiunaBI.Plugins.Morska
WORKDIR /
# Copy solution and all project files for restore
COPY DiunaBI.sln ./
COPY DiunaBI.API/DiunaBI.API.csproj DiunaBI.API/
COPY DiunaBI.Domain/DiunaBI.Domain.csproj DiunaBI.Domain/
COPY DiunaBI.Application/DiunaBI.Application.csproj DiunaBI.Application/
COPY DiunaBI.Infrastructure/DiunaBI.Infrastructure.csproj DiunaBI.Infrastructure/
COPY ${PLUGIN_PROJECT}/${PLUGIN_PROJECT}.csproj ${PLUGIN_PROJECT}/
# Restore dependencies
RUN dotnet restore DiunaBI.API/DiunaBI.API.csproj
# Copy all source code
COPY . .
# Build plugin first
WORKDIR /${PLUGIN_PROJECT}
RUN dotnet build -c Release
# Build and publish API (skip automatic plugin copy since we handle it manually)
WORKDIR /DiunaBI.API
RUN dotnet publish -c Release -o /app/publish --no-restore -p:SkipPluginCopy=true
# Copy plugin DLL to publish output
RUN mkdir -p /app/publish/Plugins && \
cp /${PLUGIN_PROJECT}/bin/Release/net10.0/${PLUGIN_PROJECT}.dll /app/publish/Plugins/
# Stage 2: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
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:7142
# Expose port (default, can be remapped in docker-compose)
EXPOSE 7142
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:7142/health || exit 1
# Run the application
ENTRYPOINT ["dotnet", "DiunaBI.API.dll"]