I have a .NET core 5.0 ASPNET Web API application. This application runs perfectly locally on Visual Studio.
Now I am trying to publish the self contained app using following command:
dotnet publish -c release testdb.sln --framework net5.0 --runtime linux-x64 /p:DebugType=None /p:DebugSymbols=false --nologo --self-contained true -v m
I am trying to run it over a Red Hat Linux image (image details below):
NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.6"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.6 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.6:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.6
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.6"
Red Hat Enterprise Linux Server release 7.6 (Maipo)
Red Hat Enterprise Linux Server release 7.6 (Maipo)
This is how my docker file looks like:
FROM testrepo.net/images/base/rhel:7.6
#published code is copied inside redhat folder
COPY redhat/ APP/
WORKDIR APP
RUN chmod +x /APP
RUN chmod +x testdb.dll
RUN chmod 777 /APP
ENTRYPOINT "./testdb.dll"
When I run this this image, I get error: ./testdb.dll: cannot execute binary file
I am not sure if this is due to invalid runtime I specified during publish command or something else.