diff --git a/Drone/Drone.Web/.dockerignore b/Drone/Drone.Web/.dockerignore new file mode 100644 index 0000000..2836780 --- /dev/null +++ b/Drone/Drone.Web/.dockerignore @@ -0,0 +1,2 @@ +bin/ +obj/ \ No newline at end of file diff --git a/Drone/Drone.Web/Dockerfile b/Drone/Drone.Web/Dockerfile new file mode 100644 index 0000000..1e177be --- /dev/null +++ b/Drone/Drone.Web/Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env +WORKDIR /app + + +COPY *.csproj ./ +RUN dotnet restore + + +COPY . ./ +RUN dotnet publish -c Release -o out + + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "Drone.Web.dll"] \ No newline at end of file diff --git a/Drone/Drone.Web/Drone.Web.csproj b/Drone/Drone.Web/Drone.Web.csproj new file mode 100644 index 0000000..842a770 --- /dev/null +++ b/Drone/Drone.Web/Drone.Web.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/Drone/Drone.Web/Program.cs b/Drone/Drone.Web/Program.cs new file mode 100644 index 0000000..a07adb2 --- /dev/null +++ b/Drone/Drone.Web/Program.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Drone.Web +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/Drone/Drone.Web/Properties/launchSettings.json b/Drone/Drone.Web/Properties/launchSettings.json new file mode 100644 index 0000000..8e67d98 --- /dev/null +++ b/Drone/Drone.Web/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:15263", + "sslPort": 44321 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Drone.Web": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Drone/Drone.Web/Startup.cs b/Drone/Drone.Web/Startup.cs new file mode 100644 index 0000000..f06797a --- /dev/null +++ b/Drone/Drone.Web/Startup.cs @@ -0,0 +1,40 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Drone.Web +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapGet("/", async context => + { + await context.Response.WriteAsync("Hello World!"); + }); + }); + } + } +} diff --git a/Drone/Drone.Web/appsettings.Development.json b/Drone/Drone.Web/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/Drone/Drone.Web/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/Drone/Drone.Web/appsettings.json b/Drone/Drone.Web/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/Drone/Drone.Web/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/Drone/Drone.sln b/Drone/Drone.sln new file mode 100644 index 0000000..1931c96 --- /dev/null +++ b/Drone/Drone.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31025.218 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drone.Web", "Drone.Web\Drone.Web.csproj", "{9DD3B6F1-7E47-4A99-8E71-BB42A9EECF39}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9DD3B6F1-7E47-4A99-8E71-BB42A9EECF39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DD3B6F1-7E47-4A99-8E71-BB42A9EECF39}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DD3B6F1-7E47-4A99-8E71-BB42A9EECF39}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DD3B6F1-7E47-4A99-8E71-BB42A9EECF39}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7A790878-F610-40AC-8953-18EFB7791A67} + EndGlobalSection +EndGlobal diff --git a/Drone/drone.yml b/Drone/drone.yml new file mode 100644 index 0000000..a65dacb --- /dev/null +++ b/Drone/drone.yml @@ -0,0 +1,17 @@ +kind: pipeline +type: docker +name: default +steps: +- name: node + image: docker + volumes: + - name: docker_sock + path: /var/run/docker.sock + commands: + - docker build --tag dronetest . + - docker rm -f dronetest || true + - docker run --name dronetest --restart always -d dronetest +volumes: + - name: docker_sock + host: + path: /var/run/docker.sock \ No newline at end of file