diff --git a/.gitignore b/.gitignore index 0e43f78..e1b5ffd 100644 --- a/.gitignore +++ b/.gitignore @@ -417,3 +417,4 @@ FodyWeavers.xsd /Services/obj/Debug/net8.0/Services.csproj.FileListAbsolute.txt /Transversal/obj/Debug/net8.0/Transversal.csproj.FileListAbsolute.txt /phronCare.Test/bin/Debug/net8.0/nunit_random_seed.tmp +*.tar diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7ec8ff2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +services: + phroncareAPI: + image: phroncare-api:latest # Asegúrate de que esta imagen esté construida localmente o en un registry + ports: + - "9000:8080" # Mapeo personalizado de puertos (host:contenedor) + - "9001:8081" + environment: + IP_ADDRESS: "0.0.0.0" + DB_CONNECT: "Server=srv01.saludlab.com.ar,39458;Initial Catalog=phroncare;TrustServerCertificate=True;User ID=sa;Password=HS|s[~xxQzTo/n>9jO;" # Conexión externa + volumes: + - ./logs:/app/logs # Monta logs desde el host + networks: + - phroncare-network + + phroncareBlazor: + image: phroncare-ui:latest # Reemplaza con el nombre de tu imagen Blazor + ports: + - "9002:80" # Puerto de la interfaz web (Blazor) + # environment: + # API_BASE_URL: "http://phroncareAPI:8080" # Usa el nombre del servicio de la API en la red Docker + volumes: + - ./uidata/appsettings.json:/usr/share/nginx/html/appsettings.json # Ajusta la ruta según tu contenedor + depends_on: + - phroncareAPI + networks: + - phroncare-network + +networks: + phroncare-network: + driver: bridge diff --git a/phronCare.API/Dockerfile b/phronCare.API/Dockerfile index 6e21c44..b509d23 100644 --- a/phronCare.API/Dockerfile +++ b/phronCare.API/Dockerfile @@ -17,7 +17,7 @@ COPY ["Core/Core.csproj", "Core/"] COPY ["Domain/Domain.csproj", "Domain/"] COPY ["Models/Models.csproj", "Models/"] COPY ["Transversal/Transversal.csproj", "Transversal/"] -COPY ["phronCareServices/phronCareServices.csproj", "phronCareServices/"] +COPY ["Services/Services.csproj", "Services/"] RUN dotnet restore "./phronCare.API/phronCare.API.csproj" COPY . . WORKDIR "/src/phronCare.API" diff --git a/phronCare.API/Program.cs b/phronCare.API/Program.cs index 9175f05..6059ddb 100644 --- a/phronCare.API/Program.cs +++ b/phronCare.API/Program.cs @@ -111,13 +111,24 @@ builder.Services.AddSwaggerGen(option => #endregion #region CORS -builder.Services.AddCors(p => p.AddPolicy("CORS", builder => +// builder.Services.AddCors(p => p.AddPolicy("CORS", builder => +// { +// builder +// .AllowAnyOrigin() +// .AllowAnyMethod() +// .AllowAnyHeader(); +// })); +builder.Services.AddCors(options => { - builder - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader(); -})); + options.AddPolicy("CORS", policy => + { + policy + .WithOrigins("http://ui.biodec.saludlab.com.ar", "http://phroncareUI:80", "http://192.168.10.110:9002") + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials(); + }); +}); #endregion builder.Services.AddControllers(); @@ -132,8 +143,8 @@ var app = builder.Build(); //} app.UseCors("CORS"); -app.UseHttpsRedirection(); -app.MapControllers(); app.UseAuthentication(); app.UseAuthorization(); +app.UseHttpsRedirection(); +app.MapControllers(); app.Run(); \ No newline at end of file diff --git a/phronCare.API/appsettings.json b/phronCare.API/appsettings.json index cf85408..eb69a0a 100644 --- a/phronCare.API/appsettings.json +++ b/phronCare.API/appsettings.json @@ -29,10 +29,10 @@ "Password": "yulaklzwjuinkddw" }, "JWT": { - "ValidIssuer": "https://localhost:7105", - "ValidAudience": "https://localhost:7034", - //"ValidIssuer": "http://phroncareAPI:8080", - //"ValidAudience": "http://phroncareAPI:8080", + // "ValidIssuer": "https://localhost:7105", + // "ValidAudience": "https://localhost:7034", + "ValidIssuer": "http://phroncareAPI:8080", + "ValidAudience": "http://phroncareAPI:8080", "Secret": "SXkSqsKyNUyvGbnHs7ke2NCq8zQzNLW7mPmHbnZZ" } } \ No newline at end of file diff --git a/phronCare.UIBlazor/wwwroot/appsettings.json b/phronCare.UIBlazor/wwwroot/appsettings.json index 43d83ec..89c4f73 100644 --- a/phronCare.UIBlazor/wwwroot/appsettings.json +++ b/phronCare.UIBlazor/wwwroot/appsettings.json @@ -7,6 +7,6 @@ } }, "AllowedHosts": "*", - "Basead": "http://localhost:5243" - //"Basead": "http://localhost:8080" version para docker + // "Basead": "http://localhost:5243" + "Basead": "http://localhost:9000" } \ No newline at end of file