Reputation: 147
Thanks to @ziyang-liu-msft I managed to deploy the image to the Azure registry in the previous post. What I see now is that after I pull the image and try to start the container, there is a folder Assets missing, this folder is available in root of src folder.
Root folder: SRC
Subfolder: Assets / Fonts / Fonts files
Every other folder I need is available in the image. I checked if the folder is available with the command
docker run -it --entrypoint sh imagename
I can see that the folder is missing.
My docker file is
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG ACCESSTOKEN
WORKDIR /src
COPY . .
RUN dotnet restore "./appfolder/app.csproj" --configfile "./appname/nuget.config"
WORKDIR "/src/appfolder"
RUN dotnet build "./app.csproj" -c $BUILD_CONFIGURATION -o /app/build --no-restore
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./app.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false --no-restore
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "app.dll"]
What am I missing here exactly?
Upvotes: 0
Views: 23
Reputation: 147
I found the issue. When changing from : FROM build AS publish to FROM base AS final, the folder is lost.
So I added
RUN cp -r /src/Assets /app/publish/
under the Publish stage.
Now I have all the files in the image.
Upvotes: 0