add docker file + change for prod
This commit is contained in:
parent
1725376623
commit
ee021510c8
@ -86,7 +86,7 @@ namespace ManagerService.Controllers
|
|||||||
/// Create an user
|
/// Create an user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newUser">New user info</param>
|
/// <param name="newUser">New user info</param>
|
||||||
[AllowAnonymous]
|
//[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(UserDetailDTO), 200)]
|
[ProducesResponseType(typeof(UserDetailDTO), 200)]
|
||||||
[ProducesResponseType(typeof(string), 400)]
|
[ProducesResponseType(typeof(string), 400)]
|
||||||
[ProducesResponseType(typeof(string), 409)]
|
[ProducesResponseType(typeof(string), 409)]
|
||||||
|
|||||||
24
ManagerService/Dockerfile
Normal file
24
ManagerService/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#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/aspnet:6.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 80
|
||||||
|
VOLUME ["/etc/managerservice"]
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["ManagerService/ManagerService.csproj", "ManagerService/"]
|
||||||
|
COPY ["Manager.Interfaces/Manager.Interfaces.csproj", "Manager.Interfaces/"]
|
||||||
|
COPY ["Manager.Framework/Manager.Framework.csproj", "Manager.Framework/"]
|
||||||
|
RUN dotnet restore "ManagerService/ManagerService.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/ManagerService"
|
||||||
|
RUN dotnet build "ManagerService.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
RUN dotnet publish "ManagerService.csproj" -c Release -o /app/publish
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "ManagerService.dll"]
|
||||||
@ -1,12 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<UserSecretsId>d2e1a747-e204-4b43-bf93-abbd19c46417</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" />
|
||||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.10.0" />
|
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.10.0" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.12.1" />
|
<PackageReference Include="MongoDB.Driver" Version="2.12.1" />
|
||||||
<PackageReference Include="MQTTnet.AspNetCore" Version="3.0.13" />
|
<PackageReference Include="MQTTnet.AspNetCore" Version="3.0.13" />
|
||||||
<PackageReference Include="NSwag.AspNetCore" Version="13.10.8" />
|
<PackageReference Include="NSwag.AspNetCore" Version="13.10.8" />
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||||
|
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<WebPublishMethod>Custom</WebPublishMethod>
|
||||||
|
<DockerPublish>true</DockerPublish>
|
||||||
|
<RegistryUrl>https://registry.unov.be</RegistryUrl>
|
||||||
|
<UserName>admin</UserName>
|
||||||
|
<PublishImageTag>latest</PublishImageTag>
|
||||||
|
<PublishProvider>ContainerRegistry</PublishProvider>
|
||||||
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
|
<ProjectGuid>042e0bc4-8dcf-4eec-8420-c71aa85d4d99</ProjectGuid>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
|
<SelfContained>false</SelfContained>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||||
|
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<WebPublishMethod>Custom</WebPublishMethod>
|
||||||
|
<DockerPublish>true</DockerPublish>
|
||||||
|
<RegistryUrl>https://registry.unov.be</RegistryUrl>
|
||||||
|
<UserName />
|
||||||
|
<PublishImageTag>latest</PublishImageTag>
|
||||||
|
<PublishProvider>ContainerRegistry</PublishProvider>
|
||||||
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
|
<ProjectGuid>042e0bc4-8dcf-4eec-8420-c71aa85d4d99</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
"iisSettings": {
|
"iisSettings": {
|
||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
@ -7,15 +8,14 @@
|
|||||||
"sslPort": 0
|
"sslPort": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_URLS": "http://*:5000/",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_URLS": "http://*:5000/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ManagerService": {
|
"ManagerService": {
|
||||||
@ -26,6 +26,22 @@
|
|||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||||
|
},
|
||||||
|
"WSL": {
|
||||||
|
"commandName": "WSL2",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "https://localhost:5001/weatherforecast",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_URLS": "https://localhost:5001;http://localhost:5000"
|
||||||
|
},
|
||||||
|
"distributionName": ""
|
||||||
|
},
|
||||||
|
"Docker": {
|
||||||
|
"commandName": "Docker",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||||
|
"publishAllPorts": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ namespace ManagerService
|
|||||||
{
|
{
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
|
|
||||||
MapConfiguration();
|
//MapConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
@ -132,7 +132,7 @@ namespace ManagerService
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddMqttClientHostedService();
|
//services.AddMqttClientHostedService();
|
||||||
services.AddScoped(typeof(ProfileLogic));
|
services.AddScoped(typeof(ProfileLogic));
|
||||||
services.AddScoped<TokensService>();
|
services.AddScoped<TokensService>();
|
||||||
services.AddScoped<UserDatabaseService>();
|
services.AddScoped<UserDatabaseService>();
|
||||||
@ -152,11 +152,12 @@ namespace ManagerService
|
|||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
//app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
app.UseExceptionHandler(HandleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseExceptionHandler(HandleError);
|
||||||
|
|
||||||
|
//app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV
|
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV
|
||||||
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas
|
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas
|
||||||
//"TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140:27017" //PROD - Thomas
|
//"TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140:27017" //PROD - Thomas
|
||||||
"TabletDb": "mongodb://admin:mdlf2021!@localhost:27017" //PROD
|
//"TabletDb": "mongodb://admin:mdlf2021!@localhost:27017" //PROD MDLF
|
||||||
|
"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017" //PROD MyMuseum
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
@ -34,6 +35,6 @@
|
|||||||
"UserName": "admin",
|
"UserName": "admin",
|
||||||
"Password": "mdlf2021!"
|
"Password": "mdlf2021!"
|
||||||
},
|
},
|
||||||
"SupportedLanguages": [ "FR", "NL", "EN", "DE", "IT", "ES", "PL", "CN" ],
|
"SupportedLanguages": [ "FR", "NL", "EN", "DE", "IT", "ES", "PL", "CN" ]
|
||||||
"Urls": "http://localhost:5002"
|
//"Urls": "http://[::]:80"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user