Recently, I upgraded a few of my projects to .NET 5.0. Most of project shipped as docker containers, the upgrade requires making some changed to docker files. Converting from .NET Core 2.2/3.1 to .NET 5 is streight forward. Here are some notes from the process:
Dockerfile files are cool when they are working. In order to make them work without additional effort is better to keep similar folder structure between the projects.
I use the following structure for my projects:
/src
/tests
/Dockerfile
.NET application docker file example
# pick image including .net sdk for compilation
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
# change directiry
WORKDIR /app
# copy
COPY src/ ./
# if special config is used
COPY nuget.config ./
# restore
RUN dotnet restore "./Api.csproj" --configfile "./nuget.config"
# publish
RUN dotnet publish "./Api.csproj" -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
COPY --from=build-env /app/out .
# expose port
EXPOSE 6032
# set .net app to expose a port
ENV ASPNETCORE_URLS http://*:6032
# run
ENTRYPOINT ["dotnet", "Api.dll"]
If console application is deployed mcr.microsoft.com/dotnet/runtime:5.0 should be used as a build image.
Debugging microservices is always tricky and time consuming specially without proper code level logging in place.
Meet Konso. It's developed as a solution for this challenge and can help with saving development effort for your team up to 30%. 🎯🎉
The key functions are:
🔥 Centralized logging for your microservices
🔥 Tracing with metrics and value tracking events
🔥 Ad-Hoc events exploration
🔥 Saving your queries
🔥 Create alerts and get notified
You can start collecting you project's logs in 5 minutes. 🕐💪
To Learn more about logging tool, book a free demo.
To get started for free, Create your free account now
No comments are allowed for this post