From fb86300d76a588cfc85826933a7e8852a3fb11c2 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 12 Jan 2019 17:02:10 -0600 Subject: [PATCH] initial add docker --- .dockerignore | 9 ++++++++ src/FilterLists.Api/Dockerfile | 21 +++++++++++++++++++ src/FilterLists.Api/FilterLists.Api.csproj | 2 ++ .../Properties/launchSettings.json | 5 +++++ src/FilterLists.Web/Dockerfile | 19 +++++++++++++++++ src/FilterLists.Web/FilterLists.Web.csproj | 2 ++ .../Properties/launchSettings.json | 5 +++++ 7 files changed, 63 insertions(+) create mode 100644 .dockerignore create mode 100644 src/FilterLists.Api/Dockerfile create mode 100644 src/FilterLists.Web/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..df2e0fe50 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.dockerignore +.env +.git +.gitignore +.vs +.vscode +*/bin +*/obj +**/.toolstarget \ No newline at end of file diff --git a/src/FilterLists.Api/Dockerfile b/src/FilterLists.Api/Dockerfile new file mode 100644 index 000000000..34248be89 --- /dev/null +++ b/src/FilterLists.Api/Dockerfile @@ -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"] \ No newline at end of file diff --git a/src/FilterLists.Api/FilterLists.Api.csproj b/src/FilterLists.Api/FilterLists.Api.csproj index fa985d570..5df3f6165 100644 --- a/src/FilterLists.Api/FilterLists.Api.csproj +++ b/src/FilterLists.Api/FilterLists.Api.csproj @@ -18,6 +18,7 @@ git https://github.com/collinbarrett/FilterLists false + Linux @@ -42,6 +43,7 @@ + diff --git a/src/FilterLists.Api/Properties/launchSettings.json b/src/FilterLists.Api/Properties/launchSettings.json index 27a7f46de..dcce7aa59 100644 --- a/src/FilterLists.Api/Properties/launchSettings.json +++ b/src/FilterLists.Api/Properties/launchSettings.json @@ -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" } } } \ No newline at end of file diff --git a/src/FilterLists.Web/Dockerfile b/src/FilterLists.Web/Dockerfile new file mode 100644 index 000000000..cd51d4d2d --- /dev/null +++ b/src/FilterLists.Web/Dockerfile @@ -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"] \ No newline at end of file diff --git a/src/FilterLists.Web/FilterLists.Web.csproj b/src/FilterLists.Web/FilterLists.Web.csproj index 309f26f94..7538963a3 100644 --- a/src/FilterLists.Web/FilterLists.Web.csproj +++ b/src/FilterLists.Web/FilterLists.Web.csproj @@ -19,6 +19,7 @@ git true false + Linux @@ -26,6 +27,7 @@ + diff --git a/src/FilterLists.Web/Properties/launchSettings.json b/src/FilterLists.Web/Properties/launchSettings.json index 0db5cdf24..8a3cc92da 100644 --- a/src/FilterLists.Web/Properties/launchSettings.json +++ b/src/FilterLists.Web/Properties/launchSettings.json @@ -13,6 +13,11 @@ "launchBrowser": true, "launchUrl": "http://localhost:5001/", "applicationUrl": "http://localhost:5001/" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/" } } } \ No newline at end of file