From 3bf0d279469deea8cbe1ec5c2b8b6390ba1f985a Mon Sep 17 00:00:00 2001 From: CodeLiturgy Date: Fri, 19 Aug 2022 00:20:06 +0100 Subject: [PATCH] Add docker files to the solution --- BlueWest.Api/Controllers/CountryController.cs | 2 +- BlueWest.Api/Startup.cs | 5 +++++ BlueWest.sln | 6 ++++++ docker-compose.yml | 7 ++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/BlueWest.Api/Controllers/CountryController.cs b/BlueWest.Api/Controllers/CountryController.cs index 38a60d8..cd6437b 100644 --- a/BlueWest.Api/Controllers/CountryController.cs +++ b/BlueWest.Api/Controllers/CountryController.cs @@ -50,7 +50,7 @@ public class CountryController : ControllerBase [HttpPost] public ActionResult AddCountry(CountryCreate countryToCreate) { - var newCountry = new Country(countryToCreate, new List()); + var newCountry = countryToCreate.ToCountry(); _dbContext.Countries.Add(newCountry); _dbContext.SaveChanges(); return CreatedAtRoute(nameof(GetCountryById), new {countryId = newCountry.Code}, newCountry); diff --git a/BlueWest.Api/Startup.cs b/BlueWest.Api/Startup.cs index 9163700..e56f78e 100644 --- a/BlueWest.Api/Startup.cs +++ b/BlueWest.Api/Startup.cs @@ -22,10 +22,15 @@ namespace BlueWest.WebApi { public class Startup { + /// + /// Startup configuration of the API + /// + /// Accessible configuration information public Startup(IConfiguration configuration) { Configuration = configuration; } + readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins"; public IConfiguration Configuration { get; } diff --git a/BlueWest.sln b/BlueWest.sln index 5b2eede..201f1a9 100644 --- a/BlueWest.sln +++ b/BlueWest.sln @@ -21,6 +21,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleExpressionEvaluator.T EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlueWest.MapTo.Tests", "include\BlueWest.MapTo\test\BlueWest.MapTo.Tests\BlueWest.MapTo.Tests.csproj", "{5BE0A68C-B3ED-4FA1-B74B-3E857504899B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{D7BF4ADC-44AA-48B1-8406-8587775A0DC6}" + ProjectSection(SolutionItems) = preProject + docker-compose.yml = docker-compose.yml + BlueWest.Api\Dockerfile = BlueWest.Api\Dockerfile + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/docker-compose.yml b/docker-compose.yml index 75456e5..4e72aa5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,9 +11,12 @@ services: restart: always links: - db:db - container_name: BAPI281 + container_name: BW1_API db: + container_name: BW1_DB_MYSQL + image: mysql/mysql-server:8.0 + tty: true environment: MYSQL_ROOT_HOST: db MYSQL_USER_HOST: db @@ -24,6 +27,8 @@ services: volumes: - ./docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/ phpmyadmin: + container_name: BW_PHPMYADMIN + tty: true image: phpmyadmin/phpmyadmin ports: - 80:80