Skip to content

Instantly share code, notes, and snippets.

@karlospn
Last active February 13, 2018 22:06
Show Gist options
  • Save karlospn/96d67bda7bcace0777ee5c535c977f3a to your computer and use it in GitHub Desktop.
Save karlospn/96d67bda7bcace0777ee5c535c977f3a to your computer and use it in GitHub Desktop.
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
EXPOSE 80
# Copy csproj and restore as distinct layers
COPY *.sln ./
COPY DockerBlankApiTest/*.csproj DockerBlankApiTest/
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish DockerBlankApiTest/*.csproj -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
COPY DockerBlankApiTest/to_copy to_copy
WORKDIR /app
COPY --from=build-env /app/DockerBlankApiTest/out .
ENTRYPOINT ["dotnet", "DockerBlankApiTest.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment