initial add docker

This commit is contained in:
Collin M. Barrett 2019-01-12 17:02:10 -06:00
parent b15b506450
commit fb86300d76
7 changed files with 63 additions and 0 deletions

9
.dockerignore Normal file
View file

@ -0,0 +1,9 @@
.dockerignore
.env
.git
.gitignore
.vs
.vscode
*/bin
*/obj
**/.toolstarget

View file

@ -0,0 +1,21 @@
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["src/FilterLists.Api/FilterLists.Api.csproj", "src/FilterLists.Api/"]
COPY ["src/FilterLists.Services/FilterLists.Services.csproj", "src/FilterLists.Services/"]
COPY ["src/FilterLists.Data/FilterLists.Data.csproj", "src/FilterLists.Data/"]
RUN dotnet restore "src/FilterLists.Api/FilterLists.Api.csproj"
COPY . .
WORKDIR "/src/src/FilterLists.Api"
RUN dotnet build "FilterLists.Api.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "FilterLists.Api.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "FilterLists.Api.dll"]

View file

@ -18,6 +18,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/collinbarrett/FilterLists</RepositoryUrl>
<ServerGarbageCollection>false</ServerGarbageCollection>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -42,6 +43,7 @@
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.3.0" />
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.2.12-alpha" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
</ItemGroup>

View file

@ -8,6 +8,11 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000/docs/index.html"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/docs/index.html"
}
}
}

View file

@ -0,0 +1,19 @@
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["src/FilterLists.Web/FilterLists.Web.csproj", "src/FilterLists.Web/"]
RUN dotnet restore "src/FilterLists.Web/FilterLists.Web.csproj"
COPY . .
WORKDIR "/src/src/FilterLists.Web"
RUN dotnet build "FilterLists.Web.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "FilterLists.Web.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "FilterLists.Web.dll"]

View file

@ -19,6 +19,7 @@
<RepositoryType>git</RepositoryType>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
<ServerGarbageCollection>false</ServerGarbageCollection>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
@ -26,6 +27,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.1" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.6" />
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.2.12-alpha" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
</ItemGroup>
<ItemGroup>

View file

@ -13,6 +13,11 @@
"launchBrowser": true,
"launchUrl": "http://localhost:5001/",
"applicationUrl": "http://localhost:5001/"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/"
}
}
}