Skip to content

Instantly share code, notes, and snippets.

@georgboe
Created March 25, 2020 17:05
Show Gist options
  • Save georgboe/01e5afb7c395fb0f649223763ce11be3 to your computer and use it in GitHub Desktop.
Save georgboe/01e5afb7c395fb0f649223763ce11be3 to your computer and use it in GitHub Desktop.
Dockerfile for ASP.NET Core projects
# Stage 1
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /build
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release \
-o /app \
-r linux-musl-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-p:PublishTrimmed=true
# Stage 2
FROM mcr.microsoft.com/dotnet/core-nightly/runtime-deps:3.1-alpine AS final
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["/app/webapptest2"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment