Add docker files to the solution

This commit is contained in:
CodeLiturgy 2022-08-19 00:20:06 +01:00
parent ce43ecf51d
commit 3bf0d27946
4 changed files with 18 additions and 2 deletions

View File

@ -50,7 +50,7 @@ public class CountryController : ControllerBase
[HttpPost] [HttpPost]
public ActionResult AddCountry(CountryCreate countryToCreate) public ActionResult AddCountry(CountryCreate countryToCreate)
{ {
var newCountry = new Country(countryToCreate, new List<Currency>()); var newCountry = countryToCreate.ToCountry();
_dbContext.Countries.Add(newCountry); _dbContext.Countries.Add(newCountry);
_dbContext.SaveChanges(); _dbContext.SaveChanges();
return CreatedAtRoute(nameof(GetCountryById), new {countryId = newCountry.Code}, newCountry); return CreatedAtRoute(nameof(GetCountryById), new {countryId = newCountry.Code}, newCountry);

View File

@ -22,10 +22,15 @@ namespace BlueWest.WebApi
{ {
public class Startup public class Startup
{ {
/// <summary>
/// Startup configuration of the API
/// </summary>
/// <param name="configuration">Accessible configuration information</param>
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
} }
readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins"; readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }

View File

@ -21,6 +21,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleExpressionEvaluator.T
EndProject 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}" 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 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU

View File

@ -11,9 +11,12 @@ services:
restart: always restart: always
links: links:
- db:db - db:db
container_name: BAPI281 container_name: BW1_API
db: db:
container_name: BW1_DB_MYSQL
image: mysql/mysql-server:8.0 image: mysql/mysql-server:8.0
tty: true
environment: environment:
MYSQL_ROOT_HOST: db MYSQL_ROOT_HOST: db
MYSQL_USER_HOST: db MYSQL_USER_HOST: db
@ -24,6 +27,8 @@ services:
volumes: volumes:
- ./docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/ - ./docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/
phpmyadmin: phpmyadmin:
container_name: BW_PHPMYADMIN
tty: true
image: phpmyadmin/phpmyadmin image: phpmyadmin/phpmyadmin
ports: ports:
- 80:80 - 80:80