Problem
The current runtime base image is mcr.microsoft.com/dotnet/aspnet:10.0, which is Debian-based. The Alpine equivalent offers a meaningfully smaller footprint with no functional difference for this application.
Estimated size reduction: ~100–150 MB.
Proposed Solution
Switch the runtime stage FROM to the Alpine variant:
# Replace:
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
# With:
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS runtime
This is the quickest size win available for this repo and requires only Dockerfile changes.
Suggested Approach
1. Update the runtime FROM
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS runtime
2. Replace apt-get with apk
Alpine uses apk, not apt-get:
# Replace:
RUN apt-get update && apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*
# With:
RUN apk add --no-cache curl
3. Replace groupadd/useradd with Alpine equivalents
# Replace:
RUN groupadd -r aspnetcore && useradd -r -g aspnetcore aspnetcore && \
mkdir -p /storage && \
chown aspnetcore:aspnetcore /storage
# With:
RUN addgroup -S aspnetcore && \
adduser -S -G aspnetcore aspnetcore && \
mkdir -p /storage && \
chown aspnetcore:aspnetcore /storage
4. Validate ICU / globalization
Alpine .NET images default to InvariantGlobalization=true. Verify whether the application relies on culture-sensitive operations (date formatting, string comparison with locale). If it does, add:
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
RUN apk add --no-cache icu-libs
If the application is culture-invariant (likely for a REST API with ISO-8601 dates and ASCII-only player data), no change is needed.
5. Key files to modify
Dockerfile — runtime FROM, apt-get → apk, groupadd/useradd → addgroup/adduser
No application code changes are required.
Relationship to other issues
This issue addresses image size. The DHI migration issue (security hardening) is separate and can be applied on top of whichever base this issue lands on — DHI also offers an Alpine-based .NET runtime variant.
Acceptance Criteria
References
Problem
The current runtime base image is
mcr.microsoft.com/dotnet/aspnet:10.0, which is Debian-based. The Alpine equivalent offers a meaningfully smaller footprint with no functional difference for this application.Estimated size reduction: ~100–150 MB.
Proposed Solution
Switch the runtime stage
FROMto the Alpine variant:This is the quickest size win available for this repo and requires only Dockerfile changes.
Suggested Approach
1. Update the runtime
FROMFROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS runtime2. Replace
apt-getwithapkAlpine uses
apk, notapt-get:3. Replace
groupadd/useraddwith Alpine equivalents4. Validate ICU / globalization
Alpine .NET images default to
InvariantGlobalization=true. Verify whether the application relies on culture-sensitive operations (date formatting, string comparison with locale). If it does, add:If the application is culture-invariant (likely for a REST API with ISO-8601 dates and ASCII-only player data), no change is needed.
5. Key files to modify
Dockerfile— runtimeFROM,apt-get→apk,groupadd/useradd→addgroup/adduserNo application code changes are required.
Relationship to other issues
This issue addresses image size. The DHI migration issue (security hardening) is separate and can be applied on top of whichever base this issue lands on — DHI also offers an Alpine-based .NET runtime variant.
Acceptance Criteria
mcr.microsoft.com/dotnet/aspnet:10.0-alpineapt-getreplaced withapkthroughout the runtime stagegroupadd/useraddreplaced withaddgroup/adduserReferences
adduser/addgroupvs Debianuseradd/groupadd