#1、修复SuperAPITest wwwroot文件夹下大小写不一致在linux下找不到文件的问题。2、添加dockerfile和docker-compose文件,支持使用docker构建

This commit is contained in:
Van Zheng
2024-05-09 18:48:21 +08:00
parent 71ac444094
commit 4d47d6aeb7
260 changed files with 213 additions and 45 deletions

32
.dockerignore Normal file
View File

@@ -0,0 +1,32 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/
**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

64
Dockerfile Normal file
View File

@@ -0,0 +1,64 @@
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
################################################################################
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
# Create a stage for building the application.
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
COPY . /source
WORKDIR /source/SuperAPI
# This is the architecture youre building for, which is passed in by the builder.
# Placing it here allows the previous steps to be cached across architectures.
ARG TARGETARCH
# Build the application.
# Leverage a cache mount to /root/.nuget/packages so that subsequent builds don't have to re-download packages.
# If TARGETARCH is "amd64", replace it with "x64" - "x64" is .NET's canonical name for this and "amd64" doesn't
# work in .NET 6.0.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app
# If you need to enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
################################################################################
# Create a new stage for running the application that contains the minimal
# runtime dependencies for the application. This often uses a different base
# image from the build stage where the necessary files are copied from the build
# stage.
#
# The example below uses an aspnet alpine image as the foundation for running the app.
# It will also use whatever happens to be the most recent version of that tag when you
# build your Dockerfile. If reproducability is important, consider using a more specific
# version (e.g., aspnet:7.0.10-alpine-3.18),
# or SHA (e.g., mcr.microsoft.com/dotnet/aspnet@sha256:f3d99f54d504a21d38e4cc2f13ff47d67235efeeb85c109d3d1ff1808b38d034).
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS final
WORKDIR /app
# Copy everything needed to run the app from the "build" stage.
COPY --from=build /app .
# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
USER appuser
ENTRYPOINT ["dotnet", "SuperAPITest.dll"]

24
README.Docker.md Normal file
View File

@@ -0,0 +1,24 @@
### Building and running your application
When you're ready, start your application by running:
`docker compose up --build`.
Your application will be available at http://localhost:8080.
### Deploying your application to the cloud
First, build your image, e.g.: `docker build -t myapp .`.
If your cloud uses a different CPU architecture than your development
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
you'll want to build the image for that platform, e.g.:
`docker build --platform=linux/amd64 -t myapp .`.
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
docs for more detail on building and pushing.
### References
* [Docker's .NET guide](https://docs.docker.com/language/dotnet/)
* The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples)
repository has many relevant samples and docs.

View File

@@ -1,35 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyVersion>1.0.4.1</AssemblyVersion>
<FileVersion>1.0.4.1</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyVersion>1.0.4.1</AssemblyVersion>
<FileVersion>1.0.4.1</FileVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="wwwroot\custom_ui01\**" />
<Compile Remove="wwwroot\custom_ui02\**" />
<Content Remove="wwwroot\custom_ui01\**" />
<Content Remove="wwwroot\custom_ui02\**" />
<EmbeddedResource Remove="wwwroot\custom_ui01\**" />
<EmbeddedResource Remove="wwwroot\custom_ui02\**" />
<None Remove="wwwroot\custom_ui01\**" />
<None Remove="wwwroot\custom_ui02\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
</ItemGroup>
<ItemGroup>
<None Remove="ReZero.db-journal" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReZero\ReZero.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReZero\ReZero.csproj"/>
</ItemGroup>
</Project>

View File

@@ -4,29 +4,44 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
},
"ReZero": {
"BasicDatabase": {
/* MySql,SqlServer,Sqlite,Oracle,PostgreSQL,Dm (),Kdbndp */
"DbType": "SqlServer",
"ConnectionString": "server=.;uid=sa;pwd=sasa;database=SuperAPI"
// "DbType": "SqlServer",
// "ConnectionString": "server=.;uid=sa;pwd=sasa;database=SuperAPI"
// "DbType": "Sqlite",
// "ConnectionString": "Data Source=SuperAPI.db",
"DbType": "PostgreSQL",
"ConnectionString": "Host=db;Username=rezero;Password=rezero123;Database=mydatabase"
// "ConnectionString": "Host=127.0.0.1;Username=rezero;Password=rezero123;Database=mydatabase"
},
"Ui": {
/*ReZerofalse,trueSwagger*/
"ShowNativeApiDocument": true
},
"Jwt": {
"Enable": false, //设置true会启用自带的jwt授权
"Secret": "C0mPl3xS3cr3tK3yF0rJWT@DEVELOPMENT",//jwt密钥
"UserTableName": "UserTable", //用户表的表名 实体管理可以创建表操作步骤1.创建实体 2.同步生成表
"UserNameFieldName": "username", //用户名字段名称 (是名称不是值)
"PasswordFieldName": "password", //密码字段名称 (是名称不是值
"Expires": 1000, //分钟
"Claim": [ // 数据库操作会用到Claim中的值作为条件
//设置true会启用自带的jwt授权
"Enable": false,
//jwt密钥
"Secret": "C0mPl3xS3cr3tK3yF0rJWT@DEVELOPMENT",
//用户表的表名 实体管理可以创建表操作步骤1.创建实体 2.同步生成表
"UserTableName": "UserTable",
//用户名字段名称 (是名称不是值)
"UserNameFieldName": "username",
//密码字段名称 (是名称不是值)
"PasswordFieldName": "password",
//分钟
"Expires": 1000,
"Claim": [
// 数据库操作会用到Claim中的值作为条件
{
"Key": "Id", //Claim Key
"FieldName": "Id", //用户表中的字段
"Type": "long" //C#类型
//Claim Key
"Key": "Id",
//用户表中的字段
"FieldName": "Id",
//C#类型
"Type": "long"
}
]
}

View File

@@ -105,7 +105,7 @@
tryItOut(item) {
var urlParams = new URLSearchParams(window.location.search);
var token = urlParams.get('token');
window.open('/rezero/TryApi.html?id=' + item.Id + "&token=" + token, '_blank');
window.open('/rezero/try_api.html?id=' + item.Id + "&token=" + token, '_blank');
},
onSearch: function () {
this.fetchData(txtSearch.value);

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 183 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -77,7 +77,7 @@
});
},
tryItOut(item) {
window.open('/rezero/TryApi.html?id=' + item.Id, '_blank');
window.open('/rezero/try_api.html?id=' + item.Id, '_blank');
},
onSearch: function () {
this.fetchData(txtSearch.value);

Some files were not shown because too many files have changed in this diff Show More