-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dotnet
More file actions
49 lines (33 loc) · 1.38 KB
/
Dockerfile.dotnet
File metadata and controls
49 lines (33 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# =============================================================================
# UDC Enterprise Platform — .NET Services Multi-Stage Dockerfile
# =============================================================================
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy solution and project files
COPY src/UDC.Classifier/UDC.Classifier.sln ./
COPY src/UDC.Classifier/UDC.Classifier.Core/UDC.Classifier.Core.csproj ./UDC.Classifier.Core/
COPY src/UDC.Classifier/UDC.Classifier.Api/UDC.Classifier.Api.csproj ./UDC.Classifier.Api/
# Restore dependencies
RUN dotnet restore
# Copy all source
COPY src/UDC.Classifier/ ./
COPY shared/ /shared/
# Build and publish
RUN dotnet publish UDC.Classifier.Api/UDC.Classifier.Api.csproj \
-c Release \
-o /app/publish \
--no-restore
# --- Runtime stage ---
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r udc && useradd -r -g udc -d /app -s /sbin/nologin udc
WORKDIR /app
COPY --from=build /app/publish .
RUN chown -R udc:udc /app
USER udc
ENV ASPNETCORE_URLS=http://+:8080 \
DOTNET_EnableDiagnostics=0
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "UDC.Classifier.Api.dll"]