From 62fe1d54bbc377ee470fcee982367c91b302ab2d Mon Sep 17 00:00:00 2001 From: Alex Meyer-Gleaves Date: Fri, 21 Feb 2025 14:42:55 +1000 Subject: [PATCH 1/4] Install ICU in runtime Docker image to Support SQL Server memory --- Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7acdca585..1687e1cc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,16 @@ RUN \ # Allow user to access the build chown -R $USER.$USER /app +# Use of Microsoft.Data.SqlClient requires ICU to be installed +# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md +ENV \ + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ + LC_ALL=en_US.UTF-8 \ + LANG=en_US.UTF-8 +RUN apk add --no-cache \ + icu-data-full \ + icu-libs + COPY --from=build --chown=km:km --chmod=0550 /app/publish . ######################################################################### From 49214f9f853cafdb4d10562a2d9a008bb47f29cc Mon Sep 17 00:00:00 2001 From: Alex Meyer-Gleaves Date: Fri, 21 Feb 2025 15:07:49 +1000 Subject: [PATCH 2/4] Update chown separator and remove language environment variables --- Dockerfile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1687e1cc4..a0ed63cf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,17 +38,12 @@ RUN \ #Debian: useradd --create-home --user-group $USER --shell /bin/bash && \ adduser -D -h /app -s /bin/sh $USER && \ # Allow user to access the build - chown -R $USER.$USER /app + chown -R $USER:$USER /app # Use of Microsoft.Data.SqlClient requires ICU to be installed # https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md -ENV \ - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ - LC_ALL=en_US.UTF-8 \ - LANG=en_US.UTF-8 -RUN apk add --no-cache \ - icu-data-full \ - icu-libs +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false +RUN apk add --no-cache icu-libs COPY --from=build --chown=km:km --chmod=0550 /app/publish . From ec2fc456bbaf80123a0f1f89a569fac272cba8b2 Mon Sep 17 00:00:00 2001 From: Alex Meyer-Gleaves Date: Fri, 21 Feb 2025 16:15:49 +1000 Subject: [PATCH 3/4] Install icu-libs in existing RUN and move ENV alongside others --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index a0ed63cf7..51427d149 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,12 +38,9 @@ RUN \ #Debian: useradd --create-home --user-group $USER --shell /bin/bash && \ adduser -D -h /app -s /bin/sh $USER && \ # Allow user to access the build - chown -R $USER:$USER /app - -# Use of Microsoft.Data.SqlClient requires ICU to be installed -# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md -ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false -RUN apk add --no-cache icu-libs + chown -R $USER:$USER /app && \ + # Install icu-libs for Microsoft.Data.SqlClient + apk add --no-cache icu-libs COPY --from=build --chown=km:km --chmod=0550 /app/publish . @@ -56,6 +53,9 @@ LABEL org.opencontainers.image.authors="Devis Lucato, https://github.com/dluc" # Define current user USER $USER +# Disable globalization invariant mode for Microsoft.Data.SqlClient +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false + # Used by .NET and KM to load appsettings.Production.json ENV ASPNETCORE_ENVIRONMENT=Production ENV ASPNETCORE_URLS=http://+:9001 From 1f73476e3d9e35b784256cb91322584dcf7796c1 Mon Sep 17 00:00:00 2001 From: Devis Lucato Date: Fri, 21 Feb 2025 14:01:17 -0800 Subject: [PATCH 4/4] Update adduser command (future proofing) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 51427d149..dabfd03b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ WORKDIR /app RUN \ # Create user #Debian: useradd --create-home --user-group $USER --shell /bin/bash && \ - adduser -D -h /app -s /bin/sh $USER && \ + adduser --disabled-password --home /app --shell /bin/sh $USER && \ # Allow user to access the build chown -R $USER:$USER /app && \ # Install icu-libs for Microsoft.Data.SqlClient