40 lines
1.5 KiB
Docker
40 lines
1.5 KiB
Docker
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
|
|
WORKDIR /src
|
|
|
|
# Version injectée par la CI (GitVersion.Agent.yml) — ex. docker build --build-arg VERSION=1.0.0
|
|
ARG VERSION=0.0.0-local
|
|
|
|
COPY *.slnx .
|
|
COPY Directory.Build.props .
|
|
COPY src/Heimdall.Domain.Primitives/*.csproj src/Heimdall.Domain.Primitives/
|
|
COPY src/Heimdall.Domain/*.csproj src/Heimdall.Domain/
|
|
COPY src/Heimdall.Application/*.csproj src/Heimdall.Application/
|
|
COPY src/Heimdall.Infrastructure/*.csproj src/Heimdall.Infrastructure/
|
|
COPY src/Heimdall.Agent/*.csproj src/Heimdall.Agent/
|
|
|
|
RUN dotnet restore src/Heimdall.Agent/Heimdall.Agent.csproj
|
|
|
|
COPY src/ src/
|
|
|
|
RUN dotnet publish src/Heimdall.Agent/Heimdall.Agent.csproj -c Release -o /app -p:Version=$VERSION
|
|
|
|
# Modèle YOLOv8n pré-converti en ONNX et committé dans le repo (voir models/)
|
|
# (ultralytics ne distribue plus d'.onnx prêt ; torch/OpenCV s'installent mal en
|
|
# CI — trop lent + deps libGL/libxcb absentes. On committe le .onnx une fois.)
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS runtime
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache icu-libs libstdc++ ffmpeg krb5 wget
|
|
|
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
|
ENV ASPNETCORE_URLS=http://+:8080
|
|
|
|
COPY --from=build /app .
|
|
# Modèle YOLOv8n ONNX committé dans le repo (contexte de build = racine repo)
|
|
COPY models/yolov8n.onnx models/yolov8n.onnx
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1
|
|
|
|
ENTRYPOINT ["dotnet", "Heimdall.Agent.dll"]
|