Browse Source

添加项目文件。

master
Nice 3 years ago
parent
commit
07c51b58b5
  1. 25
      .dockerignore
  2. 25
      SimpleDevApi.sln
  3. 21
      SimpleDevApi/Dockerfile
  4. 4
      SimpleDevApi/Program.cs
  5. 35
      SimpleDevApi/Properties/launchSettings.json
  6. 14
      SimpleDevApi/SimpleDevApi.csproj
  7. 8
      SimpleDevApi/appsettings.Development.json
  8. 9
      SimpleDevApi/appsettings.json

25
.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

25
SimpleDevApi.sln

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32002.185
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleDevApi", "SimpleDevApi\SimpleDevApi.csproj", "{DC8E3FE4-A24F-421E-A38D-A82FD9A05ADC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC8E3FE4-A24F-421E-A38D-A82FD9A05ADC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC8E3FE4-A24F-421E-A38D-A82FD9A05ADC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC8E3FE4-A24F-421E-A38D-A82FD9A05ADC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC8E3FE4-A24F-421E-A38D-A82FD9A05ADC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {58AC5A8A-2BCA-47D3-8E74-9AA1C1AE514C}
EndGlobalSection
EndGlobal

21
SimpleDevApi/Dockerfile

@ -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 ["SimpleDevApi/SimpleDevApi.csproj", "SimpleDevApi/"]
RUN dotnet restore "SimpleDevApi/SimpleDevApi.csproj"
COPY . .
WORKDIR "/src/SimpleDevApi"
RUN dotnet build "SimpleDevApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SimpleDevApi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SimpleDevApi.dll"]

4
SimpleDevApi/Program.cs

@ -0,0 +1,4 @@
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/",() => "Hello Drone!");
app.Run();

35
SimpleDevApi/Properties/launchSettings.json

@ -0,0 +1,35 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:2155",
"sslPort": 0
}
},
"profiles": {
"SimpleDevApi": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5005",
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true
}
}
}

14
SimpleDevApi/SimpleDevApi.csproj

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
</ItemGroup>
</Project>

8
SimpleDevApi/appsettings.Development.json

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

9
SimpleDevApi/appsettings.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Loading…
Cancel
Save