Skip to content

Commit

Permalink
feat: vs add: docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyungent committed Apr 13, 2022
1 parent 69ba6ff commit 0a59057
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion QQBotHub.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BDFD03E4-0A9
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QQBotPlugin", "src\QQBotPlugin\QQBotPlugin.csproj", "{1A6CAD95-2DED-42C0-BA8E-C8BA31E6AE74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QQBotHub.Web", "src\QQBotHub.Web\QQBotHub.Web.csproj", "{30B29087-4E84-4C67-BE3A-1CA8AB47B416}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QQBotHub.Web", "src\QQBotHub.Web\QQBotHub.Web.csproj", "{30B29087-4E84-4C67-BE3A-1CA8AB47B416}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{E4815DEC-037C-4781-900A-6D8005A2F33B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -23,6 +25,10 @@ Global
{30B29087-4E84-4C67-BE3A-1CA8AB47B416}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30B29087-4E84-4C67-BE3A-1CA8AB47B416}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30B29087-4E84-4C67-BE3A-1CA8AB47B416}.Release|Any CPU.Build.0 = Release|Any CPU
{E4815DEC-037C-4781-900A-6D8005A2F33B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4815DEC-037C-4781-900A-6D8005A2F33B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4815DEC-037C-4781-900A-6D8005A2F33B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4815DEC-037C-4781-900A-6D8005A2F33B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.dcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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>e4815dec-037c-4781-900a-6d8005a2f33b</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>qqbothub.web</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.4'

services:
qqbothub.web:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.4'

services:
qqbothub.web:
image: ${DOCKER_REGISTRY-}qqbothubweb
build:
context: .
dockerfile: src/QQBotHub.Web/Dockerfile
21 changes: 21 additions & 0 deletions src/QQBotHub.Web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#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:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/QQBotHub.Web/QQBotHub.Web.csproj", "src/QQBotHub.Web/"]
RUN dotnet restore "src/QQBotHub.Web/QQBotHub.Web.csproj"
COPY . .
WORKDIR "/src/src/QQBotHub.Web"
RUN dotnet build "QQBotHub.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "QQBotHub.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "QQBotHub.Web.dll"]
16 changes: 11 additions & 5 deletions src/QQBotHub.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
Expand All @@ -11,13 +11,13 @@
"profiles": {
"QQBot.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5193",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "http://localhost:5193",
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
Expand All @@ -26,6 +26,12 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true
}
}
}
}
4 changes: 4 additions & 0 deletions src/QQBotHub.Web/QQBotHub.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Konata.Core" Version="1.3.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="PluginCore" Version="0.9.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
Expand Down

0 comments on commit 0a59057

Please sign in to comment.