Hello @Solly Ramolefo ,
Is that Dockerfile manually generated by you or auto-generated by visual Studio solution?
I just tried the automated approach for pushing the .net core 5.0 Blazor App to ACR.
While creating the Blazor App solution , can you select the "Docker Support" so that the Dockerfile will be generated automatically and later on try to push it to the registry using the same Visual Studio Solution - that's what I did just now - If it fails for the first time - retry the operation using the same Visual Studio Solution.
FYI , below is the auto-generated dockerfile by VS:
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["blazor.csproj", "."]
RUN dotnet restore "./blazor.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "blazor.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "blazor.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "blazor.dll"]
////////////////////
Output of publishing to ACR:
Build started...
1>------ Build started: Project: blazor, Configuration: Release Any CPU ------
1>blazor -> C:\Users\shpatpi\source\repos\blazor\bin\Release\net5.0\blazor.dll
1>blazor -> C:\Users\shpatpi\source\repos\blazor\bin\Release\net5.0\blazor.Views.dll
2>------ Publish started: Project: blazor, Configuration: Release Any CPU ------
blazor -> C:\Users\shpatpi\source\repos\blazor\bin\Release\net5.0\blazor.dll
blazor -> C:\Users\shpatpi\source\repos\blazor\bin\Release\net5.0\blazor.Views.dll
blazor -> C:\Users\shpatpi\source\repos\blazor\obj\Docker\publish\
Docker version 20.10.10, build b485636
docker build -f "C:\Users\shpatpi\source\repos\blazor\Dockerfile" --force-rm -t blazor --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=blazor" "C:\Users\shpatpi\source\repos\blazor"
1 [internal] load build definition from Dockerfile
1 sha256:a2101dde9296e0b8cc68c9aad99bd1af8d33be7471acf65bf2e5f9d57c437b30
1 transferring dockerfile: 32B done
1 DONE 0.0s
2 [internal] load .dockerignore
2 sha256:9649adcf3c12989b56640cb37e5ba0e834240782aea203ed2de472bce9250307
2 transferring context: 35B done
2 DONE 0.0s
4 [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:5.0
4 sha256:3b35130338ebb888f84ec0aa58f64d182f10a676a625072200f5903996d93690
4 DONE 0.0s
3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0
3 sha256:f9541e65151d9de1e3f5d68829cd8cc3defacb0e940b12af587e2bb43b9d95ff
3 DONE 0.6s
8 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:5.0@sha256:bce1e40a24da092c31513337a39a1b9f923e32884a57dd71cbe4c2f8d1f4b067
8 sha256:6acdc47ddd56edeae44375354437afdf692d2f08310b051338e629ccd8fdc87f
8 DONE 0.0s
5 [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:5.0
5 sha256:31acc33a1535ed7869167d21032ed94a0e9b41bbf02055dc5f04524507860176
5 DONE 0.0s
10 [internal] load build context
10 sha256:fb2cd2467dba9764595a43a42573e71ac15c480b0b28ae2e819edb0dcc1dd443
10 transferring context: 2.86kB 0.0s done
10 DONE 0.0s
9 [build 2/7] WORKDIR /src
9 sha256:8ed7618103f9ff0d8019d62cb94da3f9ad1e9cb9aabf26a801422781b2db6eac
9 CACHED
11 [build 3/7] COPY [blazor.csproj, .]
11 sha256:25b71035d3d06c5b056232ab56b63be22a427b5dce3613570a0df3d3fb59eb9e
11 CACHED
12 [build 4/7] RUN dotnet restore "./blazor.csproj"
12 sha256:8c229bf9b623a9bbf2d682fdfea8fef326b0cee8dedc5d1b0963c58f969ca3f1
12 CACHED
13 [build 5/7] COPY . .
13 sha256:c32a1f198e08c8c91801182e9e08709a909962da84f1b89940c8f9cfc7a2313c
13 DONE 0.1s
14 [build 6/7] WORKDIR /src/.
14 sha256:5ef5e5655007301c32bcb496c64ae28ebbba124a1d243cb42bf10303c5ca1bbf
14 DONE 0.1s
15 [build 7/7] RUN dotnet build "blazor.csproj" -c Release -o /app/build
15 sha256:33654506e6827dd4bfc0b60acdcb9c5343c70654bbcccee6498c581a8b1640fc
15 0.482 Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET
15 0.482 Copyright (C) Microsoft Corporation. All rights reserved.
15 0.482
15 0.985 Determining projects to restore...
15 1.262 All projects are up-to-date for restore.
15 5.767 blazor -> /app/build/blazor.dll
15 5.769 blazor -> /app/build/blazor.Views.dll
15 5.780
15 5.780 Build succeeded.
15 5.780 0 Warning(s)
15 5.780 0 Error(s)
15 5.780
15 5.780 Time Elapsed 00:00:05.24
15 DONE 5.9s
16 [publish 1/1] RUN dotnet publish "blazor.csproj" -c Release -o /app/publish
16 sha256:36fd7eb9ca38390c01a10c57ec77eaa7a280b6b8f7e50d61bc15d6baa93aba0d
16 0.541 Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET
16 0.541 Copyright (C) Microsoft Corporation. All rights reserved.
16 0.541
16 1.148 Determining projects to restore...
16 1.432 All projects are up-to-date for restore.
16 2.183 blazor -> /src/bin/Release/net5.0/blazor.dll
16 2.186 blazor -> /src/bin/Release/net5.0/blazor.Views.dll
16 2.242 blazor -> /app/publish/
16 DONE 2.3s
6 [base 2/2] WORKDIR /app
6 sha256:56abde746b4f39a24525b2b730b2dfb6d9688bcf704d367c86a4753aefff33f6
6 CACHED
7 [final 1/2] WORKDIR /app
7 sha256:a9febba43e6acda5282f590270532cd8e201c2451b0115fba292af8909b0bbd7
7 CACHED
17 [final 2/2] COPY --from=publish /app/publish .
17 sha256:7381d747acef46f5c0dde39c89b3a273101c192ae61b604377dbfa6df270999c
17 CACHED
18 exporting to image
18 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
18 exporting layers done
18 writing image sha256:6b334c643886be0665ae2d49e30026e29852555f2f387d1022031603a99f35d3 done
18 naming to docker.io/library/blazor done
18 DONE 0.1s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
==========
Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
==========
Publish: 1 succeeded, 0 failed, 0 skipped ==========
Successfully pushed docker image with tag 'latest'