Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 730 Bytes

README.md

File metadata and controls

54 lines (37 loc) · 730 Bytes

Microservices with .NET Core 2

Init

# Create a new app in the current directory
$ dotnet new console

# Create a new app in the folder myApp
$ dotnet new console -o myApp

Publish

$ dotnet publish -o app

Restore

$ dotnet restore

Dockerize

Create a .dockerignore:

bin\
obj\
FROM microsoft/apsnetcore-build:2.0 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/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "microservice.dll"]