Skip to content

Instantly share code, notes, and snippets.

@SaurabhLpRocks
Created September 15, 2019 15:30
Show Gist options
  • Save SaurabhLpRocks/44c50714a37bc138eae06e4386cfddc8 to your computer and use it in GitHub Desktop.
Save SaurabhLpRocks/44c50714a37bc138eae06e4386cfddc8 to your computer and use it in GitHub Desktop.
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["CoreApi.csproj", "CoreApi.csproj"]
RUN dotnet restore "CoreApi.csproj"
COPY . .
RUN dotnet build "CoreApi.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "CoreApi.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "CoreApi.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment