microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.38k stars 2.22k forks source link

Random missing dependencies on runtime after unrelated code changes #1286

Open floatas opened 3 years ago

floatas commented 3 years ago

.net core 3.1

Building with DevOps Azure Pipelines, Ubuntu 16.04

Code changes: image

Result when running docker container: image

Before code change everything was working.

More and more often I encounter random runtime issues while changing unrelated code. I'm not sure in which repository should I create ticket.

Anyone else have these kind of issues ? any suggestions how to debug or solve it ?

My docker file:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine3.11 AS build-env
WORKDIR /app

# Copy everything else and build
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out --no-restore

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine3.11
WORKDIR /app

COPY --from=build-env /app/out .
CMD ["dotnet", "Project.dll"]
MichaelSimons commented 3 years ago

@floatas, One thought that came to my mind when I saw your issue. Do you have a .dockerignore that excludes the bin and obj from getting copied into the Docker context? Not excluding the local bin and obj directories can cause issues similar to what you report if you build locally before running your Docker build when the RIDs between the two environments do not match.

floatas commented 3 years ago

Didn't think about this, makes sense. Will give it a try