add docer-componse

pull/30/head
Bobo 4 years ago
parent 8d06dc12a7
commit cd1d71ca88

@ -93,7 +93,7 @@
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<Content Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\favicon.ico">
@ -426,6 +426,9 @@
<None Update="doc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Dockerfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>

@ -0,0 +1,11 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
EXPOSE 80
COPY ./ /app
ENV TZ=Asia/Shanghai
ENTRYPOINT ["dotnet", "CoreCms.Net.Web.Admin.dll"]

@ -25,7 +25,7 @@ namespace CoreCms.Net.Web.Admin
try
{
//确保NLog.config中连接字符串与appsettings.json中同步
NLogUtil.EnsureNlogConfig("nLog.config");
NLogUtil.EnsureNlogConfig("NLog.config");
//throw new Exception("测试异常");//for test
//其他项目启动时需要做的事情
NLogUtil.WriteAll(NLog.LogLevel.Trace, LogType.Web, "网站启动", "网站启动成功");

@ -1,11 +1,11 @@
{
"ConnectionStrings": {
"DbType": "SqlServer", //SqlServer,MySql
"SqlConnection": "Server=127.0.0.1;uid=coreshop;pwd=coreshop;Database=coreshop;MultipleActiveResultSets=true;"
"DbType": "MySql", //SqlServer,MySql
//"SqlConnection": "Server=127.0.0.1;uid=coreshop;pwd=coreshop;Database=coreshop;MultipleActiveResultSets=true;"
//SqlServerMultipleActiveResultSets=true
//"SqlConnection": "Server=127.0.0.1;Port=3306;Database=coreshopMysql;Uid=coreshopMysql;Pwd=coreshopMysql;CharSet=utf8;pooling=true;SslMode=None;Allow User Variables=true"
//Mysqlmysql5.7
"SqlConnection": "Server=192.168.20.62;Port=3306;Database=coreshop;Uid=root;Pwd=admin"
// Mysqlmysql5.7
},
//
"HangFire": {
@ -20,7 +20,7 @@
"RedisConfig": {
"Enabled": false, //redis
"UseRedisMessageQueue": false, //redis
"ConnectionString": "redis.demo.coreshop.com.cn:6379,password=coreshop,connectTimeout=1000,connectRetry=1,syncTimeout=10000,DefaultDatabase=8" //redis
"ConnectionString": "192.168.20.62:6379,password=123456,connectTimeout=1000,connectRetry=1,syncTimeout=10000,DefaultDatabase=8" //redis
},
//jwt
"JwtConfig": {

@ -14,7 +14,7 @@
dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient"
connectionString="Server=127.0.0.1;Database=BaseMIS;User ID=sa;Password=123456"
-->
<target name="log_database" xsi:type="Database" dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient" connectionString="Server=127.0.0.1;uid=coreshop;pwd=coreshop;Database=coreshop;MultipleActiveResultSets=true;">
<target name="log_database" xsi:type="Database" dbProvider="MySql.Data.MySqlClient.MySqlConnection,Mysql.Data" connectionString="Server=192.168.20.62;Port=3306;Database=coreshop;Uid=root;Pwd=admin">
<commandText>
INSERT INTO SysNLogRecords
(LogDate,LogLevel,LogType,LogTitle,Logger,Message,MachineName,MachineIp,NetRequestMethod

@ -87,7 +87,7 @@
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<Content Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
@ -120,6 +120,9 @@
<None Update="doc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Dockerfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>

@ -0,0 +1,14 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
EXPOSE 80
COPY ./ /app
ENV TZ=Asia/Shanghai
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /usr/lib/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "CoreCms.Net.Web.WebApi.dll"]

@ -26,7 +26,7 @@ namespace CoreCms.Net.Web.WebApi
try
{
//确保NLog.config中连接字符串与appsettings.json中同步
NLogUtil.EnsureNlogConfig("nLog.config");
NLogUtil.EnsureNlogConfig("NLog.config");
//其他项目启动时需要做的事情
NLogUtil.WriteAll(LogLevel.Trace, LogType.Web, "接口启动", "接口启动成功");

@ -1,11 +1,11 @@
{
"ConnectionStrings": {
"DbType": "SqlServer", //SqlServer,MySql
"SqlConnection": "Server=127.0.0.1;uid=coreshop;pwd=coreshop;Database=coreshop;MultipleActiveResultSets=true;"
"DbType": "MySql", //SqlServer,MySql
//"SqlConnection": "Server=127.0.0.1;uid=coreshop;pwd=coreshop;Database=coreshop;MultipleActiveResultSets=true;"
//SqlServerMultipleActiveResultSets=true
//"SqlConnection": "Server=127.0.0.1;Port=3306;Database=coreshopMysql;Uid=coreshopMysql;Pwd=coreshopMysql;CharSet=utf8;pooling=true;SslMode=None;Allow User Variables=true"
//Mysqlmysql5.7
"SqlConnection": "Server=192.168.20.62;Port=3306;Database=coreshop;Uid=root;Pwd=admin"
// Mysqlmysql5.7
},
//
"HangFire": {
@ -20,7 +20,7 @@
"RedisConfig": {
"Enabled": false, //redis
"UseRedisMessageQueue": false, //redis
"ConnectionString": "redis.demo.coreshop.com.cn:6379,password=coreshop,connectTimeout=1000,connectRetry=1,syncTimeout=10000,DefaultDatabase=8" //redis
"ConnectionString": "192.168.20.62:6379,password=123456,connectTimeout=1000,connectRetry=1,syncTimeout=10000,DefaultDatabase=8" //redis
},
//jwt
"JwtConfig": {

@ -14,7 +14,7 @@
dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient"
connectionString="Server=127.0.0.1;Database=BaseMIS;User ID=sa;Password=123456"
-->
<target name="log_database" xsi:type="Database" dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient" connectionString="Server=127.0.0.1;uid=coreshop;pwd=coreshop;Database=coreshop;MultipleActiveResultSets=true;">
<target name="log_database" xsi:type="Database" dbProvider="MySql.Data.MySqlClient.MySqlConnection,Mysql.Data" connectionString="Server=192.168.20.62;Port=3306;Database=coreshop;Uid=root;Pwd=admin">
<commandText>
INSERT INTO SysNLogRecords
(LogDate,LogLevel,LogType,LogTitle,Logger,Message,MachineName,MachineIp,NetRequestMethod

@ -0,0 +1,54 @@
version: '3'
services:
frontservice:
container_name: front-backend
build:
context: ./front/publish
dockerfile: Dockerfile
depends_on:
- redis
- mysql
ports:
- 8088:80
labels:
description: 'front backend web'
restart: always
webapiservice:
container_name: web-api
build:
context: ./api/publish
dockerfile: Dockerfile
depends_on:
- redis
- mysql
ports:
- 8089:80
labels:
description: 'web api'
restart: always
redis:
image: redis:lastest
ports:
- 6379:6379
expose:
- 6379
volumes:
command:
redis-server
mysql:
image: mysql:5.7.19
restart: always
ports:
- 3306:3306
expose:
- 3306
volumes:
- /usr/local/mysql/data:/var/lib/mysql
- /usr/local/mysql/conf.d:/etc/mysql/conf.d
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=2
environment:
- MYSQL_ROOT_PASSWORD=admin

@ -0,0 +1,48 @@
version: '3'
services:
frontservice:
container_name: front-backend
build:
context: ./front/publish
dockerfile: Dockerfile
ports:
- 8088:80
labels:
description: 'front backend web'
restart: always
webapiservice:
container_name: web-api
build:
context: ./api/publish
dockerfile: Dockerfile
ports:
- 8089:80
labels:
description: 'web api'
restart: always
# redis:
# image: redis:lastest
# ports:
# - 6379:6379
# expose:
# - 6379
# volumes:
# command:
# redis-server
# mysql:
# image: mysql:5.7.19
# restart: always
# ports:
# - 3306:3306
# expose:
# - 3306
# volumes:
# - /usr/local/mysql/data:/var/lib/mysql
# - /usr/local/mysql/conf.d:/etc/mysql/conf.d
# command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=2
# environment:
# - MYSQL_ROOT_PASSWORD=admin
Loading…
Cancel
Save