From 4497cab46bc8bbeb9b86d29d78522263d35fa01b Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Wed, 26 Jun 2019 18:56:16 -0500 Subject: [PATCH] dockerize Agent --- .dockerignore | 1 - docker-compose.yml | 7 +++++++ src/FilterLists.Agent/Dockerfile | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/FilterLists.Agent/Dockerfile diff --git a/.dockerignore b/.dockerignore index 68ecec390..264f886ec 100644 --- a/.dockerignore +++ b/.dockerignore @@ -32,7 +32,6 @@ LICENSE # FilterLists custom FilterLists.sln FilterLists.Api.sln -src/FilterLists.Agent imgs ops data/TPLSubscriptionAssistant.html \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 5344f0f53..65d83fc0d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,6 +56,13 @@ services: "--collation-server=utf8mb4_unicode_520_ci" ] + agent: + image: collinbarrett/filterlists.agent:latest + build: + context: . + dockerfile: src/FilterLists.Agent/Dockerfile + target: final + networks: reverse-proxy: api: diff --git a/src/FilterLists.Agent/Dockerfile b/src/FilterLists.Agent/Dockerfile new file mode 100644 index 000000000..a629232cd --- /dev/null +++ b/src/FilterLists.Agent/Dockerfile @@ -0,0 +1,27 @@ +# Context: . +# Command: docker build -f src/FilterLists.Agent/Dockerfile . + +# init base +FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine as base +ENTRYPOINT ["dotnet", "FilterLists.Agent.dll"] +WORKDIR /app + +# init build +FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build + +# restore +WORKDIR /app/src/FilterLists.Agent +COPY src/FilterLists.Agent/FilterLists.Agent.csproj . +RUN dotnet restore + +# build +COPY src/FilterLists.Agent/. . +RUN dotnet build -c Release --no-restore + +# publish +FROM build AS publish +RUN dotnet publish -c Release -o out --no-restore --no-build + +# final +FROM base as final +COPY --from=publish /app/src/FilterLists.Agent/out .