devops: added dockerfile and other configs
This commit is contained in:
		
							
								
								
									
										12
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| **/bin | ||||
| **/obj | ||||
| **/out | ||||
| **/.vs | ||||
| **/.idea | ||||
| **/.git | ||||
| **/.gitignore | ||||
| **/node_modules | ||||
| *.user | ||||
| *.swp | ||||
| *.swo | ||||
| .DS_Store | ||||
| @@ -7,8 +7,8 @@ | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Adapters.Lib" Version="1.0.13" /> | ||||
|     <PackageReference Include="BuildingBlocks.Library" Version="1.0.0" /> | ||||
|     <PackageReference Include="Core.Adapters.Lib" Version="1.0.0" /> | ||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> | ||||
|     <PackageReference Include="Refit" Version="8.0.0" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" /> | ||||
|     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" /> | ||||
|     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.0" /> | ||||
|     <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   | ||||
							
								
								
									
										42
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| # ===== Build stage ===== | ||||
| FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||||
| WORKDIR /src | ||||
|  | ||||
| # Usaremos la config de NuGet de la raíz (BaGet + nuget.org) | ||||
| COPY nuget.config ./ | ||||
|  | ||||
| # Copiamos SOLO los .csproj primero (mejor caché en restore) | ||||
| COPY Core.Inventory.Service.API/Core.Inventory.Service.API.csproj Core.Inventory.Service.API/ | ||||
| COPY Core.Inventory.Application/Core.Inventory.Application.csproj Core.Inventory.Application/ | ||||
| COPY Core.Inventory.External/Core.Inventory.External.csproj Core.Inventory.External/ | ||||
|  | ||||
| # Restaura con tu nuget.config | ||||
| RUN dotnet restore Core.Inventory.Service.API/Core.Inventory.Service.API.csproj --configfile ./nuget.config | ||||
|  | ||||
| # Ahora sí, copia todo el código | ||||
| COPY . . | ||||
|  | ||||
| # Publica artefactos (sin apphost para imagen más pequeña) | ||||
| ARG BUILD_CONFIGURATION=Release | ||||
| RUN dotnet publish Core.Inventory.Service.API/Core.Inventory.Service.API.csproj \ | ||||
|     -c $BUILD_CONFIGURATION -o /app/out /p:UseAppHost=false | ||||
|  | ||||
| # ===== Runtime stage ===== | ||||
| FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime | ||||
| WORKDIR /app | ||||
|  | ||||
| # Copiamos el publish | ||||
| COPY --from=build /app/out . | ||||
|  | ||||
| # Variables típicas (ajústalas luego en compose) | ||||
| ENV ASPNETCORE_URLS=http://+:8080 \ | ||||
|     ASPNETCORE_ENVIRONMENT=Production | ||||
|  | ||||
| # Exponemos el puerto HTTP | ||||
| EXPOSE 8080 | ||||
|  | ||||
| # Opcional: healthcheck si tienes /health | ||||
| # HEALTHCHECK --interval=30s --timeout=5s --retries=5 \ | ||||
| #   CMD wget -qO- http://localhost:8080/health || exit 1 | ||||
|  | ||||
| ENTRYPOINT ["dotnet", "Core.Inventory.Service.API.dll"] | ||||
							
								
								
									
										9
									
								
								nuget.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								nuget.config
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <configuration> | ||||
|   <packageSources> | ||||
|     <!-- Tu BaGet primero --> | ||||
|     <add key="BaGet" value="https://nuget.dream-views.com/v3/index.json" protocolVersion="3" /> | ||||
|     <!-- NuGet oficial como fallback (si quieres) --> | ||||
|     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||||
|   </packageSources> | ||||
| </configuration> | ||||
		Reference in New Issue
	
	Block a user