Skip to content

Commit

Permalink
将dockerfile更新为8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gmf520 committed Nov 28, 2023
1 parent 325f253 commit 02f688a
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 23 deletions.
47 changes: 26 additions & 21 deletions samples/web/Liuliu.Demo.WebApi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#See https://aka.ms/customizecontainer to learn how to customize your debug container and 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
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["samples/web/Liuliu.Demo.WebApi/Liuliu.Demo.WebApi.csproj", "samples/web/Liuliu.Demo.WebApi/"]
COPY ["src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj", "src/OSharp.EntityFrameworkCore.Sqlite/"]
COPY ["src/OSharp.EntityFrameworkCore/OSharp.EntityFrameworkCore.csproj", "src/OSharp.EntityFrameworkCore/"]
COPY ["src/OSharp.Utils/OSharp.Utils.csproj", "src/OSharp.Utils/"]
COPY ["src/OSharp/OSharp.csproj", "src/OSharp/"]
COPY ["src/OSharp.MiniProfiler/OSharp.MiniProfiler.csproj", "src/OSharp.MiniProfiler/"]
COPY ["src/OSharp.AspNetCore/OSharp.AspNetCore.csproj", "src/OSharp.AspNetCore/"]
COPY ["src/OSharp.Swagger/OSharp.Swagger.csproj", "src/OSharp.Swagger/"]
COPY ["src/OSharp.Log4Net/OSharp.Log4Net.csproj", "src/OSharp.Log4Net/"]
COPY ["src/OSharp.AutoMapper/OSharp.AutoMapper.csproj", "src/OSharp.AutoMapper/"]
COPY ["src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj", "src/OSharp.Hosting.Apis/"]
COPY ["src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj", "src/OSharp.Hosting.EntityConfiguration/"]
COPY ["src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj", "src/OSharp.Hosting.Core/"]
COPY ["src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj", "src/OSharp.Authorization.Functions/"]
COPY ["src/OSharp.Identity/OSharp.Identity.csproj", "src/OSharp.Identity/"]
COPY ["src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj", "src/OSharp.Authorization.Datas/"]
COPY ["src/OSharp.AspNetCore/OSharp.AspNetCore.csproj", "src/OSharp.AspNetCore/"]
COPY ["src/OSharp.EntityFrameworkCore/OSharp.EntityFrameworkCore.csproj", "src/OSharp.EntityFrameworkCore/"]
COPY ["src/OSharp.EntityFrameworkCore.MySql/OSharp.EntityFrameworkCore.MySql.csproj", "src/OSharp.EntityFrameworkCore.MySql/"]
COPY ["src/OSharp.Hangfire/OSharp.Hangfire.csproj", "src/OSharp.Hangfire/"]
COPY ["src/OSharp.EntityFrameworkCore.PostgreSql/OSharp.EntityFrameworkCore.PostgreSql.csproj", "src/OSharp.EntityFrameworkCore.PostgreSql/"]
COPY ["src/OSharp.Redis/OSharp.Redis.csproj", "src/OSharp.Redis/"]
COPY ["src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj", "src/OSharp.EntityFrameworkCore.Sqlite/"]
COPY ["src/OSharp.EntityFrameworkCore.SqlServer/OSharp.EntityFrameworkCore.SqlServer.csproj", "src/OSharp.EntityFrameworkCore.SqlServer/"]
RUN dotnet restore "samples/web/Liuliu.Demo.WebApi/Liuliu.Demo.WebApi.csproj"
COPY ["src/OSharp.Identity/OSharp.Identity.csproj", "src/OSharp.Identity/"]
COPY ["src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj", "src/OSharp.Authorization.Functions/"]
COPY ["src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj", "src/OSharp.Authorization.Datas/"]
COPY ["src/OSharp.Log4Net/OSharp.Log4Net.csproj", "src/OSharp.Log4Net/"]
COPY ["src/OSharp.MiniProfiler/OSharp.MiniProfiler.csproj", "src/OSharp.MiniProfiler/"]
COPY ["src/OSharp.Redis/OSharp.Redis.csproj", "src/OSharp.Redis/"]
COPY ["src/OSharp.Swagger/OSharp.Swagger.csproj", "src/OSharp.Swagger/"]
COPY ["src/OSharp.Hangfire/OSharp.Hangfire.csproj", "src/OSharp.Hangfire/"]
COPY ["src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj", "src/OSharp.Hosting.Core/"]
COPY ["src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj", "src/OSharp.Hosting.EntityConfiguration/"]
COPY ["src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj", "src/OSharp.Hosting.Apis/"]
COPY ["samples/web/Liuliu.Demo.WebApi/Liuliu.Demo.WebApi.csproj", "samples/web/Liuliu.Demo.WebApi/"]

RUN dotnet restore "./samples/web/Liuliu.Demo.WebApi/./Liuliu.Demo.WebApi.csproj"
COPY . .
WORKDIR "/src/samples/web/Liuliu.Demo.WebApi"
RUN dotnet build "Liuliu.Demo.WebApi.csproj" -c Release -o /app/build
RUN dotnet build "./Liuliu.Demo.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
RUN dotnet publish "Liuliu.Demo.WebApi.csproj" -c Release -o /app/publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Liuliu.Demo.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
Expand Down
93 changes: 91 additions & 2 deletions samples/web/Liuliu.Demo.WebApi/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,99 @@
{
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"CaptchaOptions": {
"CaptchaType": 9, // 验证码类型
"CodeLength": 4, // 验证码长度, 要放在CaptchaType设置后 当类型为算术表达式时,长度代表操作的个数
"ExpirySeconds": 60, // 验证码过期秒数
"IgnoreCase": true, // 比较时是否忽略大小写
"StoreageKeyPrefix": "Common:Captcha:", // 存储键前缀
"ImageOption": {
"Animation": true, // 是否启用动画
"FontSize": 32, // 字体大小
"Width": 100, // 验证码宽度
"Height": 40, // 验证码高度
"BubbleMinRadius": 5, // 气泡最小半径
"BubbleMaxRadius": 15, // 气泡最大半径
"BubbleCount": 5, // 气泡数量
"BubbleThickness": 1.5, // 气泡边沿厚度
"InterferenceLineCount": 4, // 干扰线数量
"FontFamily": "actionj" // 包含中文时请使用kaiti。可设置字体:actionj,epilog,fresnel,headache,lexo,prefix,progbot,ransom,robot,scandal,kaiti
}
},
"OSharp": {
"DbContexts": {
"SqlServer": {
"DbContextTypeName": "OSharp.Entity.DefaultDbContext,OSharp.EntityFrameworkCore",
"ConnectionString": "Server=127.0.0.1;Database=osharpns-api-dev;User Id=sa;Password=Abc123456!;TrustServerCertificate=True;",
"DatabaseType": "SqlServer",
"AuditEntityEnabled": true,
"AutoMigrationEnabled": true
}
},
"MailSender": {
"Host": "smtp.66soft.net",
"Port": 465,
"EnableSsl": true,
"DisplayName": "OSharp邮件发送",
"UserName": "osharpsender@66soft.net",
"Password": "Cculm3WYoAjuEbwl"
},
"Jwt": {
"Issuer": "osharp identity",
"Audience": "osharp api client",
"Secret": "{8619F7C3-B53C-4B85-99F0-983D351ECD82}",
"AccessExpireMins": 20,
"RefreshExpireMins": 10080, // 7天
"IsRefreshAbsoluteExpired": false,
"Enabled": true
},
"Cookie": {
"Enabled": true
},
"Mvc": {
"IsLowercaseJsonProperty": true,
"IsLowercaseUrls": true
},
"Cors": {
"PolicyName": "MyCors",
"AllowAnyHeader": true,
"WithMethods": [ "POST", "PUT", "DELETE" ],
"WithOrigins": [],
"Enabled": true
},
"Redis": {
"Configuration": "localhost",
"InstanceName": "Liuliu.Demo:"
},
"Swagger": {
"Endpoints": [
{
"Title": "框架API",
"Version": "v1",
"Url": "/swagger/v1/swagger.json"
},
{
"Title": "业务API",
"Version": "buss",
"Url": "/swagger/buss/swagger.json"
}
],
"RoutePrefix": "swagger",
"IsHideSchemas": false,
"MiniProfiler": false,
"Enabled": true
},
"Hangfire": {
"WorkerCount": 20,
//"StorageConnectionString": "Server=.;Database=osharpns.hangfire-dev;User Id=sa;Password=Abc123456!;MultipleActiveResultSets=true",
"DashboardUrl": "/hangfire",
"Roles": ""
}
}
}

0 comments on commit 02f688a

Please sign in to comment.