mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
wip misc docker updates
This commit is contained in:
parent
116279517a
commit
758c5e637b
10 changed files with 143 additions and 106 deletions
|
|
@ -1,10 +1,18 @@
|
|||
.dockerignore
|
||||
.env
|
||||
.git
|
||||
.github
|
||||
.gitattributes
|
||||
.gitignore
|
||||
.vs
|
||||
.vscode
|
||||
docker-compose.yml
|
||||
docker-compose.*.yml
|
||||
images
|
||||
ops
|
||||
scripts
|
||||
*/bin
|
||||
*/obj
|
||||
codecov.yml
|
||||
.dockerignore
|
||||
docker-compose.yml
|
||||
docker-compose.*.yml
|
||||
*.DotSettings*
|
||||
FilterLists.postman_collection.json
|
||||
LICENSE
|
||||
78
FilterLists.Api.sln
Normal file
78
FilterLists.Api.sln
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28803.202
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Api", "src\FilterLists.Api\FilterLists.Api.csproj", "{0115C4AD-63F2-4075-98F4-DF97A1A961B0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Data", "src\FilterLists.Data\FilterLists.Data.csproj", "{234B42ED-DE64-427A-9FAA-A4B4DA25BBFD}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Services", "src\FilterLists.Services\FilterLists.Services.csproj", "{8FACA060-B344-46C5-8614-5CA4273D38C4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Data.Tests", "tests\FilterLists.Data.Tests\FilterLists.Data.Tests.csproj", "{DB1E6B87-DF71-47B8-9235-BFCD1496EFA1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Services.Tests", "tests\FilterLists.Services.Tests\FilterLists.Services.Tests.csproj", "{2ACC8D42-9E7D-4447-BC2B-9449B8981CF0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B08FB2A1-A903-4C99-83E7-4991B49A9841}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{5D12BA97-CC9B-4195-8D9A-35012899D91C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data", "data", "{95556DA4-5C8B-43E4-B0E7-29DCF7F81F8A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
data\Dependent.json = data\Dependent.json
|
||||
data\FilterList.json = data\FilterList.json
|
||||
data\FilterListLanguage.json = data\FilterListLanguage.json
|
||||
data\FilterListMaintainer.json = data\FilterListMaintainer.json
|
||||
data\FilterListTag.json = data\FilterListTag.json
|
||||
data\Fork.json = data\Fork.json
|
||||
data\Language.json = data\Language.json
|
||||
data\License.json = data\License.json
|
||||
data\Maintainer.json = data\Maintainer.json
|
||||
data\Merge.json = data\Merge.json
|
||||
data\Software.json = data\Software.json
|
||||
data\SoftwareSyntax.json = data\SoftwareSyntax.json
|
||||
data\Syntax.json = data\Syntax.json
|
||||
data\Tag.json = data\Tag.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0115C4AD-63F2-4075-98F4-DF97A1A961B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0115C4AD-63F2-4075-98F4-DF97A1A961B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0115C4AD-63F2-4075-98F4-DF97A1A961B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0115C4AD-63F2-4075-98F4-DF97A1A961B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{234B42ED-DE64-427A-9FAA-A4B4DA25BBFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{234B42ED-DE64-427A-9FAA-A4B4DA25BBFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{234B42ED-DE64-427A-9FAA-A4B4DA25BBFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{234B42ED-DE64-427A-9FAA-A4B4DA25BBFD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8FACA060-B344-46C5-8614-5CA4273D38C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8FACA060-B344-46C5-8614-5CA4273D38C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8FACA060-B344-46C5-8614-5CA4273D38C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8FACA060-B344-46C5-8614-5CA4273D38C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB1E6B87-DF71-47B8-9235-BFCD1496EFA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DB1E6B87-DF71-47B8-9235-BFCD1496EFA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DB1E6B87-DF71-47B8-9235-BFCD1496EFA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB1E6B87-DF71-47B8-9235-BFCD1496EFA1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2ACC8D42-9E7D-4447-BC2B-9449B8981CF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2ACC8D42-9E7D-4447-BC2B-9449B8981CF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2ACC8D42-9E7D-4447-BC2B-9449B8981CF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2ACC8D42-9E7D-4447-BC2B-9449B8981CF0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{0115C4AD-63F2-4075-98F4-DF97A1A961B0} = {B08FB2A1-A903-4C99-83E7-4991B49A9841}
|
||||
{234B42ED-DE64-427A-9FAA-A4B4DA25BBFD} = {B08FB2A1-A903-4C99-83E7-4991B49A9841}
|
||||
{8FACA060-B344-46C5-8614-5CA4273D38C4} = {B08FB2A1-A903-4C99-83E7-4991B49A9841}
|
||||
{DB1E6B87-DF71-47B8-9235-BFCD1496EFA1} = {5D12BA97-CC9B-4195-8D9A-35012899D91C}
|
||||
{2ACC8D42-9E7D-4447-BC2B-9449B8981CF0} = {5D12BA97-CC9B-4195-8D9A-35012899D91C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2A61003B-647A-4A20-A9D0-BE5AF9077426}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -35,43 +35,10 @@ 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
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CE4AB25B-5501-42E9-B8B4-87B9C20472AC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{041F9CFA-B6F7-4DEB-9441-829DE697B1BB}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ops", "ops", "{AF336194-8932-4C99-BF8B-30FF8EC146E9}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitignore = .gitignore
|
||||
codecov.yml = codecov.yml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nginx", "nginx", "{E11FDECE-A7F7-4ECB-A61F-83C124466412}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
ops\nginx\Dockerfile = ops\nginx\Dockerfile
|
||||
ops\nginx\nginx.conf = ops\nginx\nginx.conf
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mariadb", "mariadb", "{982092B7-CCE2-4BD1-9240-E59D0817F5CF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EA7CB599-AE37-429E-A44D-E5C741F9FB3D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
ops\scripts\build.sh = ops\scripts\build.sh
|
||||
ops\scripts\cron = ops\scripts\cron
|
||||
ops\scripts\deploy.sh = ops\scripts\deploy.sh
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sql", "sql", "{D44C45FF-1AF9-4404-8510-418D9981B7CD}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
ops\scripts\sql\createDb.sql = ops\scripts\sql\createDb.sql
|
||||
ops\scripts\sql\duplicateRules.sql = ops\scripts\sql\duplicateRules.sql
|
||||
ops\scripts\sql\orphanedSnapshotsRules.sql = ops\scripts\sql\orphanedSnapshotsRules.sql
|
||||
ops\scripts\sql\resetSnapshotsRules.sql = ops\scripts\sql\resetSnapshotsRules.sql
|
||||
ops\scripts\sql\snapshotMetrics.sql = ops\scripts\sql\snapshotMetrics.sql
|
||||
ops\scripts\sql\snapshotTimeAnalysis.sql = ops\scripts\sql\snapshotTimeAnalysis.sql
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -106,10 +73,6 @@ 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
|
||||
|
|
@ -122,11 +85,6 @@ Global
|
|||
{4F39D132-498D-4A93-9F6C-1C604718300D} = {CE4AB25B-5501-42E9-B8B4-87B9C20472AC}
|
||||
{7D9F0D85-E906-401A-BDAD-724440B34567} = {041F9CFA-B6F7-4DEB-9441-829DE697B1BB}
|
||||
{DA34DED7-B352-4855-9C7B-9E3D983DBE2E} = {041F9CFA-B6F7-4DEB-9441-829DE697B1BB}
|
||||
{94FF757E-0A78-4E9C-971E-A0709206AC27} = {AF336194-8932-4C99-BF8B-30FF8EC146E9}
|
||||
{E11FDECE-A7F7-4ECB-A61F-83C124466412} = {AF336194-8932-4C99-BF8B-30FF8EC146E9}
|
||||
{982092B7-CCE2-4BD1-9240-E59D0817F5CF} = {AF336194-8932-4C99-BF8B-30FF8EC146E9}
|
||||
{EA7CB599-AE37-429E-A44D-E5C741F9FB3D} = {AF336194-8932-4C99-BF8B-30FF8EC146E9}
|
||||
{D44C45FF-1AF9-4404-8510-418D9981B7CD} = {EA7CB599-AE37-429E-A44D-E5C741F9FB3D}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8A31B449-52DD-4445-A9C4-033A24E25308}
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
<?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>94ff757e-0a78-4e9c-971e-a0709206ac27</ProjectGuid>
|
||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||
<DockerServiceName>filterlists.api</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="docker-compose.prod.yml" />
|
||||
<None Include="docker-compose.filterlists-api.yml" />
|
||||
<None Include=".dockerignore" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,15 +1,24 @@
|
|||
version: "3.7"
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- reverse-proxy
|
||||
volumes:
|
||||
- ./ops/nginx/dev/conf.d:/etc/nginx/conf.d:ro
|
||||
|
||||
filterlists-api:
|
||||
image: collinbarrett/filterlists.api
|
||||
restart: always
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/FilterLists.Api/Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
networks:
|
||||
- reverse-proxy
|
||||
- filterlists-api
|
||||
depends_on:
|
||||
- mariadb_filterlists-api
|
||||
|
|
@ -18,6 +27,7 @@ services:
|
|||
|
||||
mariadb_filterlists-api:
|
||||
image: mariadb:10
|
||||
restart: always
|
||||
networks:
|
||||
- filterlists-api
|
||||
volumes:
|
||||
|
|
@ -35,6 +45,7 @@ services:
|
|||
]
|
||||
|
||||
networks:
|
||||
reverse-proxy:
|
||||
filterlists-api:
|
||||
|
||||
volumes:
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
FROM nginx:stable-alpine
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
15
ops/nginx/dev/conf.d/filterlists-api.conf
Normal file
15
ops/nginx/dev/conf.d/filterlists-api.conf
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
server {
|
||||
listen 80;
|
||||
|
||||
location ^~ /api {
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
proxy_pass http://filterlists-api:5000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
worker_processes 4;
|
||||
|
||||
events { worker_connections 1024; }
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location ^~ /api {
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
proxy_pass http://FilterLists.Api:80;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://FilterLists.Web:80;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,18 +2,34 @@
|
|||
# Command: docker build -f src/FilterLists.Api/Dockerfile .
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
# restore
|
||||
COPY ./FilterLists.Api.sln ./
|
||||
COPY src/*/*.csproj ./
|
||||
RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*}/ && mv $file src/${file%.*}/; done
|
||||
COPY tests/*/*.csproj ./
|
||||
RUN for file in $(ls *.csproj); do mkdir -p tests/${file%.*}/ && mv $file tests/${file%.*}/; done
|
||||
RUN dotnet restore
|
||||
|
||||
# build
|
||||
COPY src/FilterLists.Data/. ./FilterLists.Data/
|
||||
COPY src/FilterLists.Services/. ./FilterLists.Services/
|
||||
COPY src/FilterLists.Api/. ./FilterLists.Api/
|
||||
RUN dotnet publish FilterLists.Api/FilterLists.Api.csproj -c Release -o out
|
||||
COPY tests/FilterLists.Data.Tests/. ./tests/FilterLists.Data.Tests/
|
||||
COPY tests/FilterLists.Services.Tests/. ./tests/FilterLists.Services.Tests/
|
||||
RUN dotnet build -c Release --no-restore
|
||||
|
||||
# test
|
||||
RUN dotnet test "./tests/FilterLists.Data.Tests/FilterLists.Data.Tests.csproj" -c Release --no-build --no-restore
|
||||
RUN dotnet test "./tests/FilterLists.Services.Tests/FilterLists.Services.Tests.csproj" -c Release --no-build --no-restore
|
||||
|
||||
# publish
|
||||
RUN dotnet publish FilterLists.Api/FilterLists.Api.csproj -c Release -o out --no-build --no-restore
|
||||
|
||||
# run
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/FilterLists.Api/out ./
|
||||
COPY data/. ./data/
|
||||
ENV DataDirectory:Path="data"
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
ENTRYPOINT ["dotnet", "FilterLists.Api.dll"]
|
||||
ENV ASPNETCORE_URLS http://+:5000
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT ["dotnet", "FilterLists.Api.dll"]
|
||||
COPY --from=build /FilterLists.Api/out ./
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\FilterLists.Api\FilterLists.Api.csproj" />
|
||||
<ProjectReference Include="..\..\src\FilterLists.Data\FilterLists.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue