-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 1.83 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
# ── Build stage ────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy solution and project files for layer caching
COPY EngineeringSimulator.sln ./
COPY src/EngineeringSimulator.Domain/EngineeringSimulator.Domain.csproj src/EngineeringSimulator.Domain/
COPY src/EngineeringSimulator.Application/EngineeringSimulator.Application.csproj src/EngineeringSimulator.Application/
COPY src/EngineeringSimulator.Infrastructure/EngineeringSimulator.Infrastructure.csproj src/EngineeringSimulator.Infrastructure/
COPY src/EngineeringSimulator.API/EngineeringSimulator.API.csproj src/EngineeringSimulator.API/
COPY tests/EngineeringSimulator.Domain.Tests/EngineeringSimulator.Domain.Tests.csproj tests/EngineeringSimulator.Domain.Tests/
COPY tests/EngineeringSimulator.API.Tests/EngineeringSimulator.API.Tests.csproj tests/EngineeringSimulator.API.Tests/
RUN dotnet restore
# Copy all source and build
COPY . .
RUN dotnet publish src/EngineeringSimulator.API/EngineeringSimulator.API.csproj \
-c Release -o /app/publish --no-restore
# ── Test stage (optional, for CI) ─────────────────────────
FROM build AS test
RUN dotnet test --no-restore --verbosity normal
# ── Runtime stage ─────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080
ENV ASPNETCORE_ENVIRONMENT=Production
EXPOSE 8080
COPY --from=build /app/publish .
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "EngineeringSimulator.API.dll"]