From b02c1b825dcc83fa31371860028edd5fcc288e05 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 15 May 2018 16:27:10 +0200 Subject: [PATCH] Migrate all dockerfiles to use 2.1 image. Added ApiBehaviorOptions into Catalog --- src/ApiGateways/ApiGw-Base/Dockerfile | 4 +- .../Mobile.Bff.Shopping/aggregator/Dockerfile | 4 +- .../Web.Bff.Shopping/aggregator/Dockerfile | 4 +- src/Services/Basket/Basket.API/Dockerfile | 4 +- .../Controllers/CatalogController.cs | 3 +- .../Catalog.API/Controllers/PicController.cs | 2 +- src/Services/Catalog/Catalog.API/Dockerfile | 4 +- src/Services/Catalog/Catalog.API/Startup.cs | 304 ++++++++++-------- src/Services/Identity/Identity.API/Dockerfile | 4 +- .../Location/Locations.API/Dockerfile | 4 +- .../Marketing/Marketing.API/Dockerfile | 4 +- src/Services/Ordering/Ordering.API/Dockerfile | 4 +- .../Ordering.BackgroundTasks/Dockerfile | 4 +- .../Ordering/Ordering.SignalrHub/Dockerfile | 4 +- src/Services/Payment/Payment.API/Dockerfile | 4 +- src/Web/WebMVC/Dockerfile | 4 +- src/Web/WebSPA/Dockerfile | 4 +- src/Web/WebStatus/Dockerfile | 4 +- 18 files changed, 211 insertions(+), 158 deletions(-) diff --git a/src/ApiGateways/ApiGw-Base/Dockerfile b/src/ApiGateways/ApiGw-Base/Dockerfile index 7f0cf43a6..7fdd5f073 100644 --- a/src/ApiGateways/ApiGw-Base/Dockerfile +++ b/src/ApiGateways/ApiGw-Base/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj src/ApiGateways/ApiGw-Base/ RUN dotnet restore src/ApiGateways/ApiGw-Base/ diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile index 273743cee..6acdac235 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile index ce6f1b155..96772801a 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Basket/Basket.API/Dockerfile b/src/Services/Basket/Basket.API/Dockerfile index 03a967a72..21a86a5ed 100644 --- a/src/Services/Basket/Basket.API/Dockerfile +++ b/src/Services/Basket/Basket.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs index 71f700762..20d1b1215 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs @@ -15,6 +15,7 @@ using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers { [Route("api/v1/[controller]")] + [ApiController] public class CatalogController : ControllerBase { private readonly CatalogContext _catalogContext; @@ -25,8 +26,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers { _catalogContext = context ?? throw new ArgumentNullException(nameof(context)); _catalogIntegrationEventService = catalogIntegrationEventService ?? throw new ArgumentNullException(nameof(catalogIntegrationEventService)); - _settings = settings.Value; + ((DbContext)context).ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } diff --git a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs index f8e986e50..c7af86eed 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers -{ +{ public class PicController : Controller { private readonly IHostingEnvironment _env; diff --git a/src/Services/Catalog/Catalog.API/Dockerfile b/src/Services/Catalog/Catalog.API/Dockerfile index a1279db8c..f7a13f611 100644 --- a/src/Services/Catalog/Catalog.API/Dockerfile +++ b/src/Services/Catalog/Catalog.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index 5eec48959..a6c17995b 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -1,35 +1,37 @@ -namespace Microsoft.eShopOnContainers.Services.Catalog.API +using Autofac; +using Autofac.Extensions.DependencyInjection; +using global::Catalog.API.Infrastructure.Filters; +using global::Catalog.API.IntegrationEvents; +using Microsoft.ApplicationInsights.Extensibility; +using Microsoft.ApplicationInsights.ServiceFabric; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Azure.ServiceBus; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; +using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; +using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services; +using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; +using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling; +using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.HealthChecks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using RabbitMQ.Client; +using System; +using System.Data.Common; +using System.Reflection; + +namespace Microsoft.eShopOnContainers.Services.Catalog.API { - using Autofac; - using Autofac.Extensions.DependencyInjection; - using global::Catalog.API.Infrastructure.Filters; - using global::Catalog.API.IntegrationEvents; - using Microsoft.ApplicationInsights.Extensibility; - using Microsoft.ApplicationInsights.ServiceFabric; - using Microsoft.AspNetCore.Builder; - using Microsoft.AspNetCore.Hosting; - using Microsoft.Azure.ServiceBus; - using Microsoft.EntityFrameworkCore; - using Microsoft.EntityFrameworkCore.Diagnostics; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; - using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; - using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services; - using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; - using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling; - using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.HealthChecks; - using Microsoft.Extensions.Logging; - using Microsoft.Extensions.Options; - using RabbitMQ.Client; - using System; - using System.Data.Common; - using System.Reflection; - public class Startup { public Startup(IConfiguration configuration) @@ -41,21 +43,94 @@ public IServiceProvider ConfigureServices(IServiceCollection services) { - // Add framework services. + services.AddAppInsight(Configuration) + .AddCustomMVC(Configuration) + .AddCustomDbContext(Configuration) + .AddCustomOptions(Configuration) + .AddEventBus(Configuration) + .AddSwagger(); + + var container = new ContainerBuilder(); + container.Populate(services); + return new AutofacServiceProvider(container.Build()); + + } + + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + //Configure logs + + loggerFactory.AddAzureWebAppDiagnostics(); + loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace); + + var pathBase = Configuration["PATH_BASE"]; + + if (!string.IsNullOrEmpty(pathBase)) + { + loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'"); + app.UsePathBase(pathBase); + } + +#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously + app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200)); +#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously + + app.UseCors("CorsPolicy"); + + app.UseMvcWithDefaultRoute(); - RegisterAppInsights(services); + app.UseSwagger() + .UseSwaggerUI(c => + { + c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Catalog.API V1"); + }); + + ConfigureEventBus(app); + } + protected virtual void ConfigureEventBus(IApplicationBuilder app) + { + var eventBus = app.ApplicationServices.GetRequiredService(); + eventBus.Subscribe(); + eventBus.Subscribe(); + } + } + + public static class CustomExtensionMethods + { + public static IServiceCollection AddAppInsight(this IServiceCollection services, IConfiguration configuration) + { + services.AddApplicationInsightsTelemetry(configuration); + var orchestratorType = configuration.GetValue("OrchestratorType"); + + if (orchestratorType?.ToUpper() == "K8S") + { + // Enable K8s telemetry initializer + services.EnableKubernetes(); + } + if (orchestratorType?.ToUpper() == "SF") + { + // Enable SF telemetry initializer + services.AddSingleton((serviceProvider) => + new FabricTelemetryInitializer()); + } + + return services; + } + + public static IServiceCollection AddCustomMVC(this IServiceCollection services, IConfiguration configuration) + { services.AddHealthChecks(checks => { var minutes = 1; - if (int.TryParse(Configuration["HealthCheck:Timeout"], out var minutesParsed)) + if (int.TryParse(configuration["HealthCheck:Timeout"], out var minutesParsed)) { minutes = minutesParsed; } - checks.AddSqlCheck("CatalogDb", Configuration["ConnectionString"], TimeSpan.FromMinutes(minutes)); + checks.AddSqlCheck("CatalogDb", configuration["ConnectionString"], TimeSpan.FromMinutes(minutes)); - var accountName = Configuration.GetValue("AzureStorageAccountName"); - var accountKey = Configuration.GetValue("AzureStorageAccountKey"); + var accountName = configuration.GetValue("AzureStorageAccountName"); + var accountKey = configuration.GetValue("AzureStorageAccountKey"); if (!string.IsNullOrEmpty(accountName) && !string.IsNullOrEmpty(accountKey)) { checks.AddAzureBlobStorageCheck(accountName, accountKey); @@ -67,9 +142,23 @@ options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); + services.AddCors(options => + { + options.AddPolicy("CorsPolicy", + builder => builder.AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials()); + }); + + return services; + } + + public static IServiceCollection AddCustomDbContext(this IServiceCollection services, IConfiguration configuration) + { services.AddDbContext(options => { - options.UseSqlServer(Configuration["ConnectionString"], + options.UseSqlServer(configuration["ConnectionString"], sqlServerOptionsAction: sqlOptions => { sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name); @@ -85,7 +174,7 @@ services.AddDbContext(options => { - options.UseSqlServer(Configuration["ConnectionString"], + options.UseSqlServer(configuration["ConnectionString"], sqlServerOptionsAction: sqlOptions => { sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name); @@ -94,9 +183,35 @@ }); }); - services.Configure(Configuration); + return services; + } - // Add framework services. + public static IServiceCollection AddCustomOptions(this IServiceCollection services, IConfiguration configuration) + { + services.Configure(configuration); + services.Configure(options => + { + options.InvalidModelStateResponseFactory = context => + { + var problemDetails = new ValidationProblemDetails(context.ModelState) + { + Instance = context.HttpContext.Request.Path, + Status = StatusCodes.Status400BadRequest, + Detail = "Please refer to the errors property for additional details." + }; + + return new BadRequestObjectResult(problemDetails) + { + ContentTypes = { "application/problem+json", "application/problem+xml" } + }; + }; + }); + + return services; + } + + public static IServiceCollection AddSwagger(this IServiceCollection services) + { services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); @@ -109,21 +224,18 @@ }); }); - services.AddCors(options => - { - options.AddPolicy("CorsPolicy", - builder => builder.AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader() - .AllowCredentials()); - }); + return services; + + } + public static IServiceCollection AddIntegrationServices(IServiceCollection services, IConfiguration configuration) + { services.AddTransient>( - sp => (DbConnection c) => new IntegrationEventLogService(c)); + sp => (DbConnection c) => new IntegrationEventLogService(c)); services.AddTransient(); - if (Configuration.GetValue("AzureServiceBusEnabled")) + if (configuration.GetValue("AzureServiceBusEnabled")) { services.AddSingleton(sp => { @@ -144,93 +256,37 @@ var factory = new ConnectionFactory() { - HostName = Configuration["EventBusConnection"] + HostName = configuration["EventBusConnection"] }; - if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) + if (!string.IsNullOrEmpty(configuration["EventBusUserName"])) { - factory.UserName = Configuration["EventBusUserName"]; + factory.UserName = configuration["EventBusUserName"]; } - if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + if (!string.IsNullOrEmpty(configuration["EventBusPassword"])) { - factory.Password = Configuration["EventBusPassword"]; + factory.Password = configuration["EventBusPassword"]; } var retryCount = 5; - if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"])) + if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"])) { - retryCount = int.Parse(Configuration["EventBusRetryCount"]); + retryCount = int.Parse(configuration["EventBusRetryCount"]); } return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount); }); } - RegisterEventBus(services); - - var container = new ContainerBuilder(); - container.Populate(services); - return new AutofacServiceProvider(container.Build()); - - } - - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) - { - //Configure logs - - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - loggerFactory.AddAzureWebAppDiagnostics(); - loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace); - - var pathBase = Configuration["PATH_BASE"]; - if (!string.IsNullOrEmpty(pathBase)) - { - loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'"); - app.UsePathBase(pathBase); - } - -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200)); -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously - - app.UseCors("CorsPolicy"); - - app.UseMvcWithDefaultRoute(); - - app.UseSwagger() - .UseSwaggerUI(c => - { - c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Catalog.API V1"); - }); - - ConfigureEventBus(app); + return services; } - private void RegisterAppInsights(IServiceCollection services) + public static IServiceCollection AddEventBus(this IServiceCollection services, IConfiguration configuration) { - services.AddApplicationInsightsTelemetry(Configuration); - var orchestratorType = Configuration.GetValue("OrchestratorType"); + var subscriptionClientName = configuration["SubscriptionClientName"]; - if (orchestratorType?.ToUpper() == "K8S") - { - // Enable K8s telemetry initializer - services.EnableKubernetes(); - } - if (orchestratorType?.ToUpper() == "SF") - { - // Enable SF telemetry initializer - services.AddSingleton((serviceProvider) => - new FabricTelemetryInitializer()); - } - } - - private void RegisterEventBus(IServiceCollection services) - { - var subscriptionClientName = Configuration["SubscriptionClientName"]; - - if (Configuration.GetValue("AzureServiceBusEnabled")) + if (configuration.GetValue("AzureServiceBusEnabled")) { services.AddSingleton(sp => { @@ -254,9 +310,9 @@ var eventBusSubcriptionsManager = sp.GetRequiredService(); var retryCount = 5; - if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"])) + if (!string.IsNullOrEmpty(configuration["EventBusRetryCount"])) { - retryCount = int.Parse(Configuration["EventBusRetryCount"]); + retryCount = int.Parse(configuration["EventBusRetryCount"]); } return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount); @@ -266,12 +322,8 @@ services.AddSingleton(); services.AddTransient(); services.AddTransient(); - } - protected virtual void ConfigureEventBus(IApplicationBuilder app) - { - var eventBus = app.ApplicationServices.GetRequiredService(); - eventBus.Subscribe(); - eventBus.Subscribe(); + + return services; } } } diff --git a/src/Services/Identity/Identity.API/Dockerfile b/src/Services/Identity/Identity.API/Dockerfile index ddc884cc2..43174ce03 100644 --- a/src/Services/Identity/Identity.API/Dockerfile +++ b/src/Services/Identity/Identity.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Location/Locations.API/Dockerfile b/src/Services/Location/Locations.API/Dockerfile index e2b64ba2e..8c946fa5e 100644 --- a/src/Services/Location/Locations.API/Dockerfile +++ b/src/Services/Location/Locations.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Marketing/Marketing.API/Dockerfile b/src/Services/Marketing/Marketing.API/Dockerfile index b30986406..2fd11e2d6 100644 --- a/src/Services/Marketing/Marketing.API/Dockerfile +++ b/src/Services/Marketing/Marketing.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Ordering/Ordering.API/Dockerfile b/src/Services/Ordering/Ordering.API/Dockerfile index 6dc5f8122..ecb24f808 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile +++ b/src/Services/Ordering/Ordering.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile b/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile index a675d59ef..80788cd1d 100644 --- a/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile +++ b/src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Services/Ordering/Ordering.SignalrHub/Dockerfile b/src/Services/Ordering/Ordering.SignalrHub/Dockerfile index 005eea8cf..f2fa72f8d 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/Dockerfile +++ b/src/Services/Ordering/Ordering.SignalrHub/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY eShopOnContainers-ServicesAndWebApps.sln ./ COPY src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj src/Services/Ordering/Ordering.SignalrHub/ diff --git a/src/Services/Payment/Payment.API/Dockerfile b/src/Services/Payment/Payment.API/Dockerfile index 7b19579c1..0f1311671 100644 --- a/src/Services/Payment/Payment.API/Dockerfile +++ b/src/Services/Payment/Payment.API/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Web/WebMVC/Dockerfile b/src/Web/WebMVC/Dockerfile index a903387c8..ccf3094fe 100644 --- a/src/Web/WebMVC/Dockerfile +++ b/src/Web/WebMVC/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Web/WebSPA/Dockerfile b/src/Web/WebSPA/Dockerfile index 7b7cd47d4..4f8d3ac66 100644 --- a/src/Web/WebSPA/Dockerfile +++ b/src/Web/WebSPA/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503 diff --git a/src/Web/WebStatus/Dockerfile b/src/Web/WebStatus/Dockerfile index 16d4cbc61..d85386503 100644 --- a/src/Web/WebStatus/Dockerfile +++ b/src/Web/WebStatus/Dockerfile @@ -1,8 +1,8 @@ -FROM microsoft/aspnetcore:2.0.5 AS base +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY . . RUN dotnet restore -nowarn:msb3202,nu1503