Commit 84c5e4c2 by guanzhenshan

重新生成DockerFile,支持本地构建

parent a4a9cd2d
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div class="form-inline" style="line-height:40px;"> <div class="form-inline" style="line-height:40px;">
<div class="form-group"> <div class="form-group">
<label>账单月份</label> <label>账单月份</label>
<input id="month" name="month" type="text" class="form-control" style="width:120px;" value="" placeholder="请输入月份" /> <input id="month" name="month" type="text" class="form-control" style="width:120px;" value="@(DateTime.Now.AddMonths(-1).ToString("yyyy-MM"))" placeholder="请输入月份" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label>数据来源类型:</label> <label>数据来源类型:</label>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.1.1" /> <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.10" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.10" />
<PackageReference Include="NPOI" Version="2.4.1" /> <PackageReference Include="NPOI" Version="2.4.1" />
......
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:2.1 AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
FROM microsoft/dotnet:2.1-sdk AS build FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build
WORKDIR /src WORKDIR /src
COPY Bailun.DC.Web/Bailun.DC.Web.csproj Bailun.DC.Web/ COPY ["Bailun.DC.Web/Bailun.DC.Web.csproj", "Bailun.DC.Web/"]
COPY Bailun.DC.Services/Bailun.DC.Services.csproj Bailun.DC.Services/ COPY ["Bailun.DC.Services/Bailun.DC.Services.csproj", "Bailun.DC.Services/"]
COPY Bailun.DC.Common/Bailun.DC.Common.csproj Bailun.DC.Common/ COPY ["Bailun.DC.Common/Bailun.DC.Common.csproj", "Bailun.DC.Common/"]
COPY Bailun.DC.DB/Bailun.DC.DB.csproj Bailun.DC.DB/ COPY ["Bailun.DC.DB/Bailun.DC.DB.csproj", "Bailun.DC.DB/"]
COPY Bailun.DC.Models/Bailun.DC.Models.csproj Bailun.DC.Models/ COPY ["Bailun.DC.Models/Bailun.DC.Models.csproj", "Bailun.DC.Models/"]
RUN dotnet restore Bailun.DC.Web/Bailun.DC.Web.csproj RUN dotnet restore "Bailun.DC.Web/Bailun.DC.Web.csproj"
COPY . . COPY . .
WORKDIR /src/Bailun.DC.Web WORKDIR "/src/Bailun.DC.Web"
RUN dotnet build Bailun.DC.Web.csproj -c Release -o /app RUN dotnet build "Bailun.DC.Web.csproj" -c Release -o /app/build
FROM build AS publish FROM build AS publish
RUN dotnet publish Bailun.DC.Web.csproj -c Release -o /app RUN dotnet publish "Bailun.DC.Web.csproj" -c Release -o /app/publish
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app . COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Bailun.DC.Web.dll"] ENTRYPOINT ["dotnet", "Bailun.DC.Web.dll"]
\ No newline at end of file
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Bailun.DC.Web/Bailun.DC.Web.csproj Bailun.DC.Web/
COPY Bailun.DC.Services/Bailun.DC.Services.csproj Bailun.DC.Services/
COPY Bailun.DC.Common/Bailun.DC.Common.csproj Bailun.DC.Common/
COPY Bailun.DC.DB/Bailun.DC.DB.csproj Bailun.DC.DB/
COPY Bailun.DC.Models/Bailun.DC.Models.csproj Bailun.DC.Models/
RUN dotnet restore Bailun.DC.Web/Bailun.DC.Web.csproj
COPY . .
WORKDIR /src/Bailun.DC.Web
RUN dotnet build Bailun.DC.Web.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish Bailun.DC.Web.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Bailun.DC.Web.dll"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment