wire up docker/docker-compose vs debug support

This commit is contained in:
Collin M. Barrett 2020-02-08 18:07:42 -06:00
parent f3d6e95630
commit 1c2ae12027
7 changed files with 41 additions and 10 deletions

View file

18
docker-compose.dcproj Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>26883901-339a-44cf-8894-45f6a3a5ebab</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/{Scheme}://{ServiceHost}:{ServicePort}</DockerServiceUrl>
<DockerServiceName>filterlists.api</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include=".dockerignore" />
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
</ItemGroup>
</Project>

View file

@ -21,6 +21,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Data.Tests", "t
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Services.Tests", "tests\FilterLists.Services.Tests\FilterLists.Services.Tests.csproj", "{0F419F45-EC3F-409B-95A2-F6AEE21E4041}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "..\docker-compose.dcproj", "{26883901-339A-44CF-8894-45F6A3A5EBAB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -55,6 +57,10 @@ Global
{0F419F45-EC3F-409B-95A2-F6AEE21E4041}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F419F45-EC3F-409B-95A2-F6AEE21E4041}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F419F45-EC3F-409B-95A2-F6AEE21E4041}.Release|Any CPU.Build.0 = Release|Any CPU
{26883901-339A-44CF-8894-45F6A3A5EBAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26883901-339A-44CF-8894-45F6A3A5EBAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26883901-339A-44CF-8894-45F6A3A5EBAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26883901-339A-44CF-8894-45F6A3A5EBAB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,8 +1,12 @@
# Context: .
# Command: docker build -f server/src/FilterLists.Agent/Dockerfile .
# init base
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-alpine as base
# init vs debug base
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
WORKDIR /app
# init base-prod
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-alpine as base-prod
ENTRYPOINT ["./FilterLists.Agent"]
WORKDIR /app
@ -36,5 +40,5 @@ FROM build AS publish
RUN dotnet publish -c Release -r linux-musl-x64 -o out --no-restore --no-build
# final
FROM base as final
FROM base-prod as final
COPY --from=publish /app/src/FilterLists.Agent/out .

View file

@ -8,9 +8,8 @@
<PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
<DockerDebuggeeProgram>/usr/bin/dotnet</DockerDebuggeeProgram>
<DockerDebuggeeArguments>--additionalProbingPath /root/.nuget/fallbackpackages2 --additionalProbingPath /root/.nuget/fallbackpackages "bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).dll" -a -v</DockerDebuggeeArguments>
</PropertyGroup>
<PropertyGroup>

View file

@ -1,8 +1,13 @@
# Context: .
# Command: docker build -f server/src/FilterLists.Api/Dockerfile .
# init base
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-alpine as base
# init vs debug base
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
# init base-prod
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-alpine as base-prod
EXPOSE 80
ENTRYPOINT ["./FilterLists.Api"]
COPY data/. data/
@ -59,5 +64,5 @@ FROM build AS publish
RUN dotnet publish -c Release -r linux-musl-x64 -o out --no-restore --no-build
# final
FROM base as final
FROM base-prod as final
COPY --from=publish /app/src/FilterLists.Api/out .

View file

@ -6,9 +6,8 @@
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings>
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
<DockerfileContext>..\..</DockerfileContext>
<DockerfileFastModeStage>build</DockerfileFastModeStage>
</PropertyGroup>
<PropertyGroup>