Skip to content

Instantly share code, notes, and snippets.

@A-Programmer
Created March 6, 2022 16:36
Show Gist options
  • Save A-Programmer/33bc333ae2dcddb1af409fe126d3294c to your computer and use it in GitHub Desktop.
Save A-Programmer/33bc333ae2dcddb1af409fe126d3294c to your computer and use it in GitHub Desktop.
NETCore 6.0 project Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "HelloWorld.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment