From 92b2c553155509c929e7b258085441f66d823b30 Mon Sep 17 00:00:00 2001
From: anjoy8 <3143422472@qq.com>
Date: Thu, 11 Jun 2020 12:17:59 +0800
Subject: [PATCH] add docker file
---
.dockerignore | 25 +++++++++++++++++++
Blog.Core/Blog.Core.csproj | 8 ++++++
.../Controllers/TopicDetailController.cs | 5 ++--
Blog.Core/Dockerfile | 5 ++++
Blog.Core/Properties/launchSettings.json | 14 ++++++++---
5 files changed, 50 insertions(+), 7 deletions(-)
create mode 100644 .dockerignore
create mode 100644 Blog.Core/Dockerfile
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/.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/Blog.Core/Blog.Core.csproj b/Blog.Core/Blog.Core.csproj
index 6797ab4..fbf9334 100644
--- a/Blog.Core/Blog.Core.csproj
+++ b/Blog.Core/Blog.Core.csproj
@@ -7,6 +7,7 @@
netcoreapp3.1
OutOfProcess
+ Linux
@@ -50,6 +51,7 @@
+
@@ -88,4 +90,10 @@
+
+
+ Always
+
+
+
diff --git a/Blog.Core/Controllers/TopicDetailController.cs b/Blog.Core/Controllers/TopicDetailController.cs
index dbc0bf8..264fe2d 100644
--- a/Blog.Core/Controllers/TopicDetailController.cs
+++ b/Blog.Core/Controllers/TopicDetailController.cs
@@ -39,10 +39,11 @@ namespace Blog.Core.Controllers
/// 页数
/// 专题类型
/// 关键字
+ ///
///
[HttpGet]
[AllowAnonymous]
- public async Task>> Get(int page = 1, string tname = "", string key = "")
+ public async Task>> Get(int page = 1, string tname = "", string key = "", int intPageSize = 12)
{
int tid = 0;
@@ -61,8 +62,6 @@ namespace Blog.Core.Controllers
tid = ((await _topicServices.Query(ts => ts.tName == tname)).FirstOrDefault()?.Id).ObjToInt();
}
- int intPageSize = 6;
-
var data = await _topicDetailServices.QueryPage(a => !a.tdIsDelete && a.tdSectendDetail == "tbug" && ((tid == 0 && true) || (tid > 0 && a.TopicId == tid)) && ((a.tdName != null && a.tdName.Contains(key)) || (a.tdDetail != null && a.tdDetail.Contains(key))), page, intPageSize, " Id desc ");
diff --git a/Blog.Core/Dockerfile b/Blog.Core/Dockerfile
new file mode 100644
index 0000000..7d43f52
--- /dev/null
+++ b/Blog.Core/Dockerfile
@@ -0,0 +1,5 @@
+FROM swr.cn-south-1.myhuaweicloud.com/mcr/aspnet:3.1-alpine
+WORKDIR /app
+COPY . .
+EXPOSE 8081
+ENTRYPOINT ["dotnet", "Blog.Core.dll","-b","0.0.0.0"]
\ No newline at end of file
diff --git a/Blog.Core/Properties/launchSettings.json b/Blog.Core/Properties/launchSettings.json
index c543106..001e104 100644
--- a/Blog.Core/Properties/launchSettings.json
+++ b/Blog.Core/Properties/launchSettings.json
@@ -1,5 +1,4 @@
-{
- "$schema": "http://json.schemastore.org/launchsettings.json",
+{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
@@ -8,14 +7,15 @@
"sslPort": 0
}
},
+ "$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"Blog.Core": {
"commandName": "Project",
"launchBrowser": true,
- "applicationUrl": "http://localhost:8081",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "applicationUrl": "http://localhost:8081"
},
"IIS Express": {
"commandName": "IISExpress",
@@ -23,6 +23,12 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
+ "publishAllPorts": true
}
}
}
\ No newline at end of file