Skip to content

Instantly share code, notes, and snippets.

@namhnz
Forked from Ibro/Dockerfile
Created August 17, 2019 16:24
Show Gist options
  • Save namhnz/3643284977b759561247abf677c3e078 to your computer and use it in GitHub Desktop.
Save namhnz/3643284977b759561247abf677c3e078 to your computer and use it in GitHub Desktop.
FROM microsoft/dotnet:2.2-sdk 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 microsoft/dotnet:2.2-aspnetcore-runtime
ENV PORT=5000
WORKDIR /app
COPY --from=build-env /app/out .
CMD ASPNETCORE_URLS=http://*:$PORT dotnet AspNetCoreHerokuDocker.dll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment