Search code examples
docker.net-corerhelicuamazon-linux

Running ASP.NET Core app from Amazon Linux 2 on Docker - Globalization


I have my ASP.NET Core app running beautifully (more or less) on microsoft/aspnetcore:2.0-jessie. Now I want to try to get it to deploy to amazonlinux:2.

So far, the biggest hurdle has been libicu. I tried setting Globalization to Invariant, but this caused weird failures in, e.g., mySQL database calls.

Here's the relevant step from my Dockerfile:

RUN curl -L --http1.1 http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-RHEL6-x64.tgz --output icu.tgz \
    && tar -xf icu.tgz -C / \
    && export LD_LIBRARY_PATH=/usr/local/lib \
    && rm icu.tgz

(SourceForge was down while I was trying to work on this yesterday, which didn't improve matters.)

In any case, I still get the message of doom from .NET Core:

FailFast: Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.

Any suggestions how to proceed?


Solution

  • Well, I revisited this yesterday. I don't know if it's because the base .tar of the Amazon Linux image has been updated, or because I was doing something wrong last time, but I installed the following packages using yum and all was well:

    • libunwind
    • libicu
    • dotnet-hosting-2.0.5

    Note that for the dotnet package I needed first to set up Microsoft's package repository for yum, i.e.

    rpm --import https://packages.microsoft.com/keys/microsoft.asc
    

    and copying the following file to /etc/yum.repos.d/dotnetdev.repo :

    [packages-microsoft-com-prod] 
    name=packages-microsoft-com-prod 
    baseurl=https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod 
    enabled=1 
    gpgcheck=1 
    gpgkey=https://packages.microsoft.com/keys/microsoft.asc
    

    (see Microsoft's instructions for CentOS and other Linux distros)