.Net Core Devops - (a) configuration Dockerfile GitHub

## Introduction

linux popular today surely we have embraced core of it, the usual solutions are gitlab + jenkins + centos, but such a scheme is not suitable for my kind of lazy, we have been seeking a simple solution, in the search for solutions in We found that the current domestic third party is not friendly enough for c # ah, did not find easy to use, so I think Azure, MS have to say was quite to the edge.

Essential list


  1. Open VS, newly built ASP.NET Core Web 应用程序, namedWebNotebook
  2. Click Next, remember to enable support Docker, click Create
  3. If the previous step does not click Enable Docker support, by adding to the new
  4. Push to the code GitHub

Here is my configuration file Docker

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src

RUN ls -al

COPY ["WebNotebook/WebNotebook.csproj", "WebNotebook/"]
RUN dotnet restore "WebNotebook/WebNotebook.csproj"
COPY . .
WORKDIR "/src/WebNotebook"
RUN dotnet build "WebNotebook.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "WebNotebook.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebNotebook.dll"]

The following is a Demo of my project

https://github.com/zhaozhengyan/WebNotebook

Guess you like

Origin www.cnblogs.com/zhaozhengyan/p/dotnet_config_dockerfile.html