Skip to content

Instantly share code, notes, and snippets.

@alpersilistre
Created May 6, 2024 17:33
Show Gist options
  • Save alpersilistre/64cc89cbb8e9f810492f8a59ab25accb to your computer and use it in GitHub Desktop.
Save alpersilistre/64cc89cbb8e9f810492f8a59ab25accb to your computer and use it in GitHub Desktop.
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
EXPOSE 80
EXPOSE 443
# copy csproj and restore as distinct layers
COPY ComplexApp.Core/*.csproj ComplexApp.Core/
COPY ComplexApp.Web/*.csproj ComplexApp.Web/
RUN dotnet restore ComplexApp.Web
COPY . .
RUN dotnet publish ComplexApp.Web -c Release -o out --no-restore
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
ENV ASPNETCORE_URLS=http://*:${PORT}
WORKDIR /app
COPY --from=build /app/out .
ENTRYPOINT ["dotnet", "ComplexApp.Web.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment