added Docker file

This commit is contained in:
PramodMahajan14 2025-03-28 17:39:01 +05:30
parent 79753c33d3
commit 26d569f782
6 changed files with 84 additions and 17 deletions

30
.dockerignore Normal file
View File

@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**

View File

@ -159,15 +159,17 @@ namespace MarcoBMS.Services.Controllers
var isTokenValid = await _userManager.VerifyUserTokenAsync(
user,
TokenOptions.DefaultProvider, // This is the token provider
UserManager<ApplicationUser>.ResetPasswordTokenPurpose,
WebUtility.UrlDecode( model.Token)
// UserManager<ApplicationUser>.ResetPasswordTokenPurpose,
//WebUtility.UrlDecode( model.Token)
UserManager<ApplicationUser>.ResetPasswordTokenPurpose, model.Token
//WebUtility.UrlDecode( model.Token)
);
if (!isTokenValid)
return BadRequest("Invalid or expired token.");
var result = await _userManager.ResetPasswordAsync(user, WebUtility.UrlDecode(model.Token), model.NewPassword);
var result = await _userManager.ResetPasswordAsync(user, model.Token, model.NewPassword);
if (!result.Succeeded)
return BadRequest(result.Errors);

View File

@ -0,0 +1,33 @@
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Marco.Pms.Services/Marco.Pms.Services.csproj", "Marco.Pms.Services/"]
COPY ["Marco.Pms.DataAccess/Marco.Pms.DataAccess.csproj", "Marco.Pms.DataAccess/"]
COPY ["Marco.Pms.Model/Marco.Pms.Model.csproj", "Marco.Pms.Model/"]
COPY ["Marco.Pms.Utility/Marco.Pms.Utility.csproj", "Marco.Pms.Utility/"]
RUN dotnet restore "./Marco.Pms.Services/Marco.Pms.Services.csproj"
COPY . .
WORKDIR "/src/Marco.Pms.Services"
RUN dotnet build "./Marco.Pms.Services.csproj" -c $BUILD_CONFIGURATION -o /app/build
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Marco.Pms.Services.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Marco.Pms.Services.dll"]

View File

@ -27,6 +27,7 @@
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />

View File

@ -12,7 +12,7 @@ using Microsoft.OpenApi.Models;
using Serilog;
using System.Text;
Serilog.Debugging.SelfLog.Enable(Console.Error);
var builder = WebApplication.CreateBuilder(args);
@ -146,8 +146,9 @@ if (app.Environment.IsDevelopment())
app.UseSwagger();
app.UseSwaggerUI();
// Use CORS in the pipeline
app.UseCors("DevCorsPolicy");
}
app.UseCors("DevCorsPolicy");
app.UseStaticFiles(); // Enables serving static files

View File

@ -22,8 +22,8 @@
{
"Name": "MongoDB",
"Args": {
"databaseUrl": "mongodb://localhost:27017/DotNetLogs",
//"databaseUrl": "mongodb://devuser:xxxxx@147.93.98.152:27017/MarcoPMS?authSource=admin",
//"databaseUrl": "mongodb://localhost:27017/DotNetLogs",
"databaseUrl": "mongodb+srv://rootuser:marco123@marcocluster.xi93iig.mongodb.net/marcoCluster?retryWrites=true&w=majority",
"collectionName": "application_logs",
"batchPostingLimit": 50,
"cappedMaxSizeMb": "1024",
@ -64,8 +64,8 @@
"ConnectionStrings": {
// "DefaultConnectionString": "Server=103.50.160.45;User ID=marcowvh_admin;Password=Marcoemp@123;Database=marcowvh_empattendanceci",
"DefaultConnectionString": "Server=localhost;port=3333;User ID=root;Password=root;Database=MarcoBMS1",
// "DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS1"
//"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS1",
"DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS1"
},
"AppSettings": {
"WebFrontendUrl": "http://localhost:5173",