Skip to content

Instantly share code, notes, and snippets.

@allanchua101
Created September 21, 2018 14:57
Show Gist options
  • Save allanchua101/a5cb3894f5b0c382a92516283bc79ae4 to your computer and use it in GitHub Desktop.
Save allanchua101/a5cb3894f5b0c382a92516283bc79ae4 to your computer and use it in GitHub Desktop.
Multistage Dockerfile using Alpine
FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
# Pay attention to the following two lines
FROM microsoft/dotnet-nightly:2.1-runtime-alpine
# Alpine runtime doesn't expose 80 by default (Dang)
EXPOSE 80
WORKDIR /app
COPY --from=build-env /app/out .
# Replace Ledger.dll depending on which project
# are you containerizing.
ENTRYPOINT ["dotnet", "Ledger.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment