Docker file for .Net Core 5

This is my docker file for .net core 5

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app

ENV ASPNETCORE_URLS=http://+:8099

EXPOSE 8099

# copy csproj and restore as distinct layers
COPY *.sln .
COPY X.Model/*.*.csproj ./X.Model/
COPY X.Data/*.*.csproj ./X.Data/
COPY X.Web/*.*.csproj ./X.Web/

# copy everything else and build app
COPY X.Model/. ./X.Model/
COPY X.Data/. ./X.Data/
COPY X.Web/. ./X.Web/

RUN dotnet restore

WORKDIR /app/ContentrApp.Web
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/runtime:5.0 AS runtime
WORKDIR /app
COPY --from=build /app/ContentrApp.Web/out ./
ENTRYPOINT ["dotnet", "ContentrApp.Web.dll"]

I was playing around a bit more with ports in .net core 5 and changing them around more.

The other thing I've found is that the default dot images no longer build typescript during the build.

To build the typescript I've started adding nodejs into my images with this.

RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \ 
&& apt update \
&& apt install -y nodejs