diff --git a/.gitignore b/.gitignore index edff6a8..4b82ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,3 @@ .vs/ -Domain/bin/ -Domain/obj/ -Infrastructure/bin/ -Infrastructure/obj/ -QRCodeService/bin/ -QRCodeService/obj/ +bin/ +obj/ diff --git a/Docker/.dockerignore b/Docker/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/Docker/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Docker/docker-compose.dcproj b/Docker/docker-compose.dcproj new file mode 100644 index 0000000..544a95b --- /dev/null +++ b/Docker/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + 67e556aa-3e56-4b78-9521-6a5abed7eeea + LaunchBrowser + {Scheme}://localhost:{ServicePort}/swagger + qrcodeservice + + + + docker-compose.yml + + + + + \ No newline at end of file diff --git a/Docker/docker-compose.override.yml b/Docker/docker-compose.override.yml new file mode 100644 index 0000000..0356880 --- /dev/null +++ b/Docker/docker-compose.override.yml @@ -0,0 +1,8 @@ +version: '3.4' + +services: + qrcodeservice: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml new file mode 100644 index 0000000..82fdc94 --- /dev/null +++ b/Docker/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.4' + +services: + qrcodeservice: + image: ${DOCKER_REGISTRY-}qrcodeservice + build: + context: . + dockerfile: QRCodeService/Dockerfile diff --git a/QRCodeService.sln b/QRCodeService.sln index 6e3e5b2..b34abeb 100644 --- a/QRCodeService.sln +++ b/QRCodeService.sln @@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30804.86 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCodeService", "QRCodeService\QRCodeService.csproj", "{CF4EF394-9502-4720-8E32-30132C5A7B40}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCodeService", "QRCodeService\QRCodeService.csproj", "{CF4EF394-9502-4720-8E32-30132C5A7B40}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{FB39ABD1-A7B6-479D-9552-D81D8360E48B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "Domain\Domain.csproj", "{FB39ABD1-A7B6-479D-9552-D81D8360E48B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{3A7EB8BC-4099-461F-9E2D-D34AEC5FC056}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{3A7EB8BC-4099-461F-9E2D-D34AEC5FC056}" +EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "Docker\docker-compose.dcproj", "{67E556AA-3E56-4B78-9521-6A5ABED7EEEA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,10 @@ Global {3A7EB8BC-4099-461F-9E2D-D34AEC5FC056}.Debug|Any CPU.Build.0 = Debug|Any CPU {3A7EB8BC-4099-461F-9E2D-D34AEC5FC056}.Release|Any CPU.ActiveCfg = Release|Any CPU {3A7EB8BC-4099-461F-9E2D-D34AEC5FC056}.Release|Any CPU.Build.0 = Release|Any CPU + {67E556AA-3E56-4B78-9521-6A5ABED7EEEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {67E556AA-3E56-4B78-9521-6A5ABED7EEEA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {67E556AA-3E56-4B78-9521-6A5ABED7EEEA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {67E556AA-3E56-4B78-9521-6A5ABED7EEEA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/QRCodeService/Dockerfile b/QRCodeService/Dockerfile new file mode 100644 index 0000000..0caf7de --- /dev/null +++ b/QRCodeService/Dockerfile @@ -0,0 +1,23 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build +WORKDIR /src +COPY ["QRCodeService/QRCodeService.csproj", "QRCodeService/"] +COPY ["Domain/Domain.csproj", "Domain/"] +COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"] +RUN dotnet restore "QRCodeService/QRCodeService.csproj" +COPY . . +WORKDIR "/src/QRCodeService" +RUN dotnet build "QRCodeService.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "QRCodeService.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "QRCodeService.dll"] \ No newline at end of file diff --git a/QRCodeService/Properties/launchSettings.json b/QRCodeService/Properties/launchSettings.json index e5e9f8a..2ff030e 100644 --- a/QRCodeService/Properties/launchSettings.json +++ b/QRCodeService/Properties/launchSettings.json @@ -1,5 +1,4 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", +{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, @@ -8,6 +7,7 @@ "sslPort": 0 } }, + "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { "IIS Express": { "commandName": "IISExpress", @@ -19,13 +19,19 @@ }, "QRCodeService": { "commandName": "Project", - "dotnetRunMessages": "true", "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": "true", + "applicationUrl": "http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true } } -} +} \ No newline at end of file diff --git a/QRCodeService/QRCodeService.csproj b/QRCodeService/QRCodeService.csproj index c3af3a4..0b4421f 100644 --- a/QRCodeService/QRCodeService.csproj +++ b/QRCodeService/QRCodeService.csproj @@ -2,6 +2,8 @@ net5.0 + Linux + ..\docker-compose.dcproj @@ -11,6 +13,7 @@ + diff --git a/QRCodeService/QRCodeService.csproj.user b/QRCodeService/QRCodeService.csproj.user index d1f541e..169ccc3 100644 --- a/QRCodeService/QRCodeService.csproj.user +++ b/QRCodeService/QRCodeService.csproj.user @@ -4,7 +4,7 @@ ProjectDebugger - QRCodeService + Docker ApiControllerEmptyScaffolder root/Common/Api diff --git a/README.md b/README.md new file mode 100644 index 0000000..1488dca --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +施工图审查系统二维码短链生成服务 \ No newline at end of file