diff --git a/.dockerignore b/.dockerignore index df2e0fe50..43e8ab1e3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,7 @@ .gitignore .vs .vscode +docker-compose.yml +docker-compose.*.yml */bin */obj -**/.toolstarget \ No newline at end of file diff --git a/FilterLists.sln b/FilterLists.sln index 8a4a4abb6..83d579373 100644 --- a/FilterLists.sln +++ b/FilterLists.sln @@ -52,6 +52,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Services.Tests" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Data.Tests", "tests\FilterLists.Data.Tests\FilterLists.Data.Tests.csproj", "{DA34DED7-B352-4855-9C7B-9E3D983DBE2E}" EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{94FF757E-0A78-4E9C-971E-A0709206AC27}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -86,6 +88,10 @@ Global {DA34DED7-B352-4855-9C7B-9E3D983DBE2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA34DED7-B352-4855-9C7B-9E3D983DBE2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA34DED7-B352-4855-9C7B-9E3D983DBE2E}.Release|Any CPU.Build.0 = Release|Any CPU + {94FF757E-0A78-4E9C-971E-A0709206AC27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94FF757E-0A78-4E9C-971E-A0709206AC27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94FF757E-0A78-4E9C-971E-A0709206AC27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94FF757E-0A78-4E9C-971E-A0709206AC27}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/docker-compose.dcproj b/docker-compose.dcproj new file mode 100644 index 000000000..56ad2e9ca --- /dev/null +++ b/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + 94ff757e-0a78-4e9c-971e-a0709206ac27 + LaunchBrowser + {Scheme}://localhost:{ServicePort} + filterlists.api + + + + docker-compose.yml + + + + + \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 000000000..fc499ec89 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,15 @@ +version: '3.4' + +services: + filterlists.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + filterlists.web: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..ad1677ccb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.4' + +services: + filterlists.api: + image: ${DOCKER_REGISTRY-}filterlistsapi + build: + context: . + dockerfile: src/FilterLists.Api/Dockerfile + + filterlists.web: + image: ${DOCKER_REGISTRY-}filterlistsweb + build: + context: . + dockerfile: src/FilterLists.Web/Dockerfile + diff --git a/src/FilterLists.Api/Dockerfile b/src/FilterLists.Api/Dockerfile index 34248be89..34c127cfc 100644 --- a/src/FilterLists.Api/Dockerfile +++ b/src/FilterLists.Api/Dockerfile @@ -4,18 +4,18 @@ 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 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 +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 +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 +ENTRYPOINT ["dotnet", "FilterLists.Api.dll"] diff --git a/src/FilterLists.Api/FilterLists.Api.csproj b/src/FilterLists.Api/FilterLists.Api.csproj index 5df3f6165..d32b446a7 100644 --- a/src/FilterLists.Api/FilterLists.Api.csproj +++ b/src/FilterLists.Api/FilterLists.Api.csproj @@ -19,6 +19,7 @@ https://github.com/collinbarrett/FilterLists false Linux + ..\..\docker-compose.dcproj diff --git a/src/FilterLists.Web/Dockerfile b/src/FilterLists.Web/Dockerfile index cd51d4d2d..23a45c8ff 100644 --- a/src/FilterLists.Web/Dockerfile +++ b/src/FilterLists.Web/Dockerfile @@ -4,16 +4,16 @@ 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 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 +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 +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 +ENTRYPOINT ["dotnet", "FilterLists.Web.dll"] diff --git a/src/FilterLists.Web/FilterLists.Web.csproj b/src/FilterLists.Web/FilterLists.Web.csproj index 7538963a3..14297f7dc 100644 --- a/src/FilterLists.Web/FilterLists.Web.csproj +++ b/src/FilterLists.Web/FilterLists.Web.csproj @@ -20,6 +20,7 @@ true false Linux + ..\..\docker-compose.dcproj