 Daniel Gyulai
					
					5 years ago
						Daniel Gyulai
					
					5 years ago
					
				
				 7 changed files with 152 additions and 0 deletions
			
			
		| @ -0,0 +1,13 @@ | |||||
|  | <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
|  | 
 | ||||
|  |   <PropertyGroup> | ||||
|  |     <TargetFramework>netcoreapp3.1</TargetFramework> | ||||
|  |     <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||||
|  |     <DockerfileContext>..\..</DockerfileContext> | ||||
|  |   </PropertyGroup> | ||||
|  | 
 | ||||
|  |   <ItemGroup> | ||||
|  |     <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" /> | ||||
|  |   </ItemGroup> | ||||
|  | 
 | ||||
|  | </Project> | ||||
| @ -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/core/aspnet:3.1-buster-slim AS base | ||||
|  | WORKDIR /app | ||||
|  | EXPOSE 80 | ||||
|  | 
 | ||||
|  | FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build | ||||
|  | WORKDIR /src | ||||
|  | COPY ["covidok-backend/CoviDok/CoviDok.csproj", "covidok-backend/CoviDok/"] | ||||
|  | RUN dotnet restore "covidok-backend/CoviDok/CoviDok.csproj" | ||||
|  | COPY . . | ||||
|  | WORKDIR "/src/covidok-backend/CoviDok" | ||||
|  | RUN dotnet build "CoviDok.csproj" -c Release -o /app/build | ||||
|  | 
 | ||||
|  | FROM build AS publish | ||||
|  | RUN dotnet publish "CoviDok.csproj" -c Release -o /app/publish | ||||
|  | 
 | ||||
|  | FROM base AS final | ||||
|  | WORKDIR /app | ||||
|  | COPY --from=publish /app/publish . | ||||
|  | ENTRYPOINT ["dotnet", "CoviDok.dll"] | ||||
| @ -0,0 +1,26 @@ | |||||
|  | using System; | ||||
|  | using System.Collections.Generic; | ||||
|  | using System.Linq; | ||||
|  | using System.Threading.Tasks; | ||||
|  | using Microsoft.AspNetCore.Hosting; | ||||
|  | using Microsoft.Extensions.Configuration; | ||||
|  | using Microsoft.Extensions.Hosting; | ||||
|  | using Microsoft.Extensions.Logging; | ||||
|  | 
 | ||||
|  | namespace CoviDok | ||||
|  | { | ||||
|  |     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<Startup>(); | ||||
|  |                 }); | ||||
|  |     } | ||||
|  | } | ||||
| @ -0,0 +1,33 @@ | |||||
|  | { | ||||
|  |   "iisSettings": { | ||||
|  |     "windowsAuthentication": false, | ||||
|  |     "anonymousAuthentication": true, | ||||
|  |     "iisExpress": { | ||||
|  |       "applicationUrl": "http://localhost:56030", | ||||
|  |       "sslPort": 0 | ||||
|  |     } | ||||
|  |   }, | ||||
|  |   "profiles": { | ||||
|  |     "IIS Express": { | ||||
|  |       "commandName": "IISExpress", | ||||
|  |       "launchBrowser": true, | ||||
|  |       "environmentVariables": { | ||||
|  |         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|  |       } | ||||
|  |     }, | ||||
|  |     "CoviDok": { | ||||
|  |       "commandName": "Project", | ||||
|  |       "launchBrowser": true, | ||||
|  |       "environmentVariables": { | ||||
|  |         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|  |       }, | ||||
|  |       "applicationUrl": "http://localhost:5000" | ||||
|  |     }, | ||||
|  |     "Docker": { | ||||
|  |       "commandName": "Docker", | ||||
|  |       "launchBrowser": true, | ||||
|  |       "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", | ||||
|  |       "publishAllPorts": true | ||||
|  |     } | ||||
|  |   } | ||||
|  | } | ||||
| @ -0,0 +1,40 @@ | |||||
|  | using System; | ||||
|  | using System.Collections.Generic; | ||||
|  | using System.Linq; | ||||
|  | using System.Threading.Tasks; | ||||
|  | using Microsoft.AspNetCore.Builder; | ||||
|  | using Microsoft.AspNetCore.Hosting; | ||||
|  | using Microsoft.AspNetCore.Http; | ||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||
|  | using Microsoft.Extensions.Hosting; | ||||
|  | 
 | ||||
|  | namespace CoviDok | ||||
|  | { | ||||
|  |     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!"); | ||||
|  |                 }); | ||||
|  |             }); | ||||
|  |         } | ||||
|  |     } | ||||
|  | } | ||||
| @ -0,0 +1,9 @@ | |||||
|  | { | ||||
|  |   "Logging": { | ||||
|  |     "LogLevel": { | ||||
|  |       "Default": "Information", | ||||
|  |       "Microsoft": "Warning", | ||||
|  |       "Microsoft.Hosting.Lifetime": "Information" | ||||
|  |     } | ||||
|  |   } | ||||
|  | } | ||||
| @ -0,0 +1,10 @@ | |||||
|  | { | ||||
|  |   "Logging": { | ||||
|  |     "LogLevel": { | ||||
|  |       "Default": "Information", | ||||
|  |       "Microsoft": "Warning", | ||||
|  |       "Microsoft.Hosting.Lifetime": "Information" | ||||
|  |     } | ||||
|  |   }, | ||||
|  |   "AllowedHosts": "*" | ||||
|  | } | ||||
					Loading…
					
					
				
		Reference in new issue