Skip to content

Instantly share code, notes, and snippets.

@BaezCrdrm
Created October 12, 2020 21:04
Show Gist options
  • Save BaezCrdrm/f53b3f57e394e94e608bcc77c940d797 to your computer and use it in GitHub Desktop.
Save BaezCrdrm/f53b3f57e394e94e608bcc77c940d797 to your computer and use it in GitHub Desktop.
Dockerfile .NET Core
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["ProjectName.csproj", "./"]
RUN dotnet restore "ProjectName.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "ProjectName.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ProjectName.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ProjectName.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment