C
C#7mo ago
Luki

✅ Publish linux-arm64 app to DockerHub not working

I am trying to publish an asp.net api project directly to the DockerHub using VisualStudio with these publish Settings which you can see below. My DockerFile:
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
RUN dotnet restore "WebApplication1/WebApplication1.csproj"
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build "WebApplication1.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WebApplication1.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
RUN dotnet restore "WebApplication1/WebApplication1.csproj"
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build "WebApplication1.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WebApplication1.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]
using this Dockerfile, Docker says that the os is linux and the architexture is amd64 despite the publish settings in Visual Studio. So i cant run it on my Raspi. I also tried using this base/build image:
aspnet/sdk:7.0-alpine3.18-arm64v8
aspnet/sdk:7.0-alpine3.18-arm64v8
then docker build throws following exception:
9 | WORKDIR /src
10 | COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
11 | >>> RUN dotnet restore "WebApplication1/WebApplication1.csproj"
12 | COPY . .
13 | WORKDIR "/src/WebApplication1"
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet restore \"WebApplication1/WebApplication1.csproj\"" did not complete successfully: exit code: 1 WebApplication1 D:\Code\WebApplication1\WebApplication1\Dockerfile
9 | WORKDIR /src
10 | COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
11 | >>> RUN dotnet restore "WebApplication1/WebApplication1.csproj"
12 | COPY . .
13 | WORKDIR "/src/WebApplication1"
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet restore \"WebApplication1/WebApplication1.csproj\"" did not complete successfully: exit code: 1 WebApplication1 D:\Code\WebApplication1\WebApplication1\Dockerfile
Yes my App is called WebApplication1 (just created it to test if i can publish it) :). Hope you can help me. Thank you :)
No description
1 Reply
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View