From 1c2ae120272348ad6900dec67acb42439ed605c7 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 8 Feb 2020 18:07:42 -0600 Subject: [PATCH] wire up docker/docker-compose vs debug support --- server/.gitignore => .gitignore | 0 docker-compose.dcproj | 18 ++++++++++++++++++ server/FilterLists.sln | 6 ++++++ server/src/FilterLists.Agent/Dockerfile | 10 +++++++--- .../FilterLists.Agent/FilterLists.Agent.csproj | 3 +-- server/src/FilterLists.Api/Dockerfile | 11 ++++++++--- .../src/FilterLists.Api/FilterLists.Api.csproj | 3 +-- 7 files changed, 41 insertions(+), 10 deletions(-) rename server/.gitignore => .gitignore (100%) create mode 100644 docker-compose.dcproj diff --git a/server/.gitignore b/.gitignore similarity index 100% rename from server/.gitignore rename to .gitignore diff --git a/docker-compose.dcproj b/docker-compose.dcproj new file mode 100644 index 000000000..6ff97a0fc --- /dev/null +++ b/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + 26883901-339a-44cf-8894-45f6a3a5ebab + LaunchBrowser + {Scheme}://localhost:{ServicePort}/{Scheme}://{ServiceHost}:{ServicePort} + filterlists.api + + + + + docker-compose.yml + + + + \ No newline at end of file diff --git a/server/FilterLists.sln b/server/FilterLists.sln index 6350d2d7f..d8192fa13 100644 --- a/server/FilterLists.sln +++ b/server/FilterLists.sln @@ -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 diff --git a/server/src/FilterLists.Agent/Dockerfile b/server/src/FilterLists.Agent/Dockerfile index 6510e0326..f6ca1e05f 100644 --- a/server/src/FilterLists.Agent/Dockerfile +++ b/server/src/FilterLists.Agent/Dockerfile @@ -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 . diff --git a/server/src/FilterLists.Agent/FilterLists.Agent.csproj b/server/src/FilterLists.Agent/FilterLists.Agent.csproj index 324a99fc1..0fbaa365d 100644 --- a/server/src/FilterLists.Agent/FilterLists.Agent.csproj +++ b/server/src/FilterLists.Agent/FilterLists.Agent.csproj @@ -8,9 +8,8 @@ true Exe linux-musl-x64 + Linux ..\..\docker-compose.dcproj - /usr/bin/dotnet - --additionalProbingPath /root/.nuget/fallbackpackages2 --additionalProbingPath /root/.nuget/fallbackpackages "bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).dll" -a -v diff --git a/server/src/FilterLists.Api/Dockerfile b/server/src/FilterLists.Api/Dockerfile index f997bfbe0..ca6af3ffe 100644 --- a/server/src/FilterLists.Api/Dockerfile +++ b/server/src/FilterLists.Api/Dockerfile @@ -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 . diff --git a/server/src/FilterLists.Api/FilterLists.Api.csproj b/server/src/FilterLists.Api/FilterLists.Api.csproj index adb41b2fd..b29e94b25 100644 --- a/server/src/FilterLists.Api/FilterLists.Api.csproj +++ b/server/src/FilterLists.Api/FilterLists.Api.csproj @@ -6,9 +6,8 @@ true true linux-musl-x64 + Linux ..\..\docker-compose.dcproj - ..\.. - build