-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (48 loc) · 2.43 KB
/
Dockerfile
File metadata and controls
59 lines (48 loc) · 2.43 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
50
51
52
53
54
55
56
57
58
59
# Multi-stage Dockerfile for BudgetExperiment
# Builds from source and creates optimized runtime image
# Supports multi-architecture builds (amd64, arm64)
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG VERSION=0.0.0-docker
WORKDIR /build
# Copy project files for restore
COPY ["Directory.Build.props", "./"]
COPY ["stylecop.json", "./"]
COPY ["src/BudgetExperiment.Domain/BudgetExperiment.Domain.csproj", "src/BudgetExperiment.Domain/"]
COPY ["src/BudgetExperiment.Application/BudgetExperiment.Application.csproj", "src/BudgetExperiment.Application/"]
COPY ["src/BudgetExperiment.Infrastructure/BudgetExperiment.Infrastructure.csproj", "src/BudgetExperiment.Infrastructure/"]
COPY ["src/BudgetExperiment.Api/BudgetExperiment.Api.csproj", "src/BudgetExperiment.Api/"]
COPY ["src/BudgetExperiment.Client/BudgetExperiment.Client.csproj", "src/BudgetExperiment.Client/"]
COPY ["src/BudgetExperiment.Contracts/BudgetExperiment.Contracts.csproj", "src/BudgetExperiment.Contracts/"]
# Restore dependencies
RUN dotnet restore "src/BudgetExperiment.Api/BudgetExperiment.Api.csproj"
# Copy all source code
COPY ["src/", "src/"]
# Publish (combines build and publish in one step to avoid path issues)
# Pass VERSION to override MinVer (which can't read .git in Docker)
RUN dotnet publish "src/BudgetExperiment.Api/BudgetExperiment.Api.csproj" \
-c ${BUILD_CONFIGURATION} \
-o /app/publish \
--no-restore \
/p:UseAppHost=false \
/p:MinVerVersionOverride=${VERSION}
# Runtime stage — chiseled-extra: distroless Ubuntu Noble with ICU globalization data,
# non-root (UID 1654) by default, no shell/package manager.
# The -extra variant is required because the app uses culture-aware localization (en-US).
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble-chiseled-extra AS runtime
WORKDIR /app
# Copy published application
COPY --from=build /app/publish .
# Expose port
EXPOSE 8080
# Environment variables (can be overridden at runtime)
ENV ASPNETCORE_URLS=http://+:8080
ENV ASPNETCORE_ENVIRONMENT=Production
# Disable globalization-invariant mode so ICU cultures (en-US) work correctly.
# The chiseled-extra image includes ICU but still defaults to invariant mode.
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
# No HEALTHCHECK — chiseled images have no shell or curl.
# Health monitoring via docker-compose or external access to /health endpoint.
# Entry point
ENTRYPOINT ["dotnet", "BudgetExperiment.Api.dll"]