Explorar el Código

code cleanup

dev
anastasijasavov hace 3 años
padre
commit
6366192954

+ 25
- 0
.dockerignore Ver fichero

@@ -0,0 +1,25 @@
**/.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

+ 7
- 69
Dockerfile Ver fichero

@@ -1,83 +1,21 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base

WORKDIR /app

EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

WORKDIR /src

COPY ["SpotifyService/SpotifyService.csproj", "SpotifyService/SpotifyService/"]

COPY ["IdentityProvider/IdentityProvider.csproj", "IdentityProvider/IdentityProvider/"]

COPY ["NemAnBlazor/NemAnBlazor.csproj", "NemAnBlazor/NemAnBlazor/"]

COPY ["SpotifyWorker/SpotifyWorker.csproj", "SpotifyWorker/SpotifyWorker/"]

COPY *.sln .

COPY *.csproj ./

RUN dotnet restore "SpotifyService/SpotifyService.csproj"

RUN dotnet restore "IdentityProvider/IdentityProvider.csproj"

COPY ["NemAnBlazor.csproj", "NemAnBlazor/"]
COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"]
RUN dotnet restore "NemAnBlazor/NemAnBlazor.csproj"

RUN dotnet restore "SpotifyWorker/SpotifyWorker.csproj"

COPY . .

WORKDIR "/src/SpotifyService/SpotifyService"

RUN dotnet build "SpotifyService.csproj" -c Release -o /app/build

COPY . .

WORKDIR "/src/IdentityProvider/IdentityProvider"

RUN dotnet build "IdentityProvider.csproj" -c Release -o /app/build1

COPY . .

WORKDIR "/src/NemAnBlazor/NemAnBlazor"

RUN dotnet build "NemAnBlazor.csproj" -c Release -o /app/build2

COPY . .

WORKDIR "/src/SpotifyWorker/SpotifyWorker"

RUN dotnet build "SpotifyWorker.csproj" -c Release -o /app/build3
WORKDIR "/src/NemAnBlazor"
RUN dotnet build "NemAnBlazor.csproj" -c Release -o /app/build

FROM build AS publish

RUN dotnet publish -c Release -o /app/publish "/src/SpotifyService/SpotifyService.csproj"

RUN dotnet publish -c Release -o /app/publish1 "/src/IdentityProvider/IdentityProvider.csproj"

RUN dotnet publish -c Release -o /app/publish2 "/src/NemAnBlazor/NemAnBlazor.csproj"

RUN dotnet publish -c Release -o /app/publish3 "/src/SpotifyWorker/SpotifyWorker.csproj"
RUN dotnet publish "NemAnBlazor.csproj" -c Release -o /app/publish

FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT ["dotnet", "SpotifyService.dll"]

COPY --from=publish /app/publish1 .

ENTRYPOINT ["dotnet", "IdentityProvider.dll"]

COPY --from=publish /app/publish2 .

ENTRYPOINT ["dotnet", "NemAnBlazor.dll"]

COPY --from=publish /app/publish3 .

ENTRYPOINT ["dotnet", "SpotifyWorker.dll"]
ENTRYPOINT ["dotnet", "NemAnBlazor.dll"]

+ 23
- 0
IdentityProvider/Dockerfile Ver fichero

@@ -0,0 +1,23 @@
#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
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["IdentityProvider.csproj", "IdentityProvider/"]
COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"]
RUN dotnet restore "IdentityProvider/IdentityProvider.csproj"
COPY . .
WORKDIR "/src/IdentityProvider"
RUN dotnet build "IdentityProvider.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "IdentityProvider.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "IdentityProvider.dll"]

+ 24
- 21
IdentityProvider/IdentityProvider.csproj Ver fichero

@@ -1,27 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>25fedcaf-21d8-4904-9c0a-8cb4c1428e50</UserSecretsId>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" />
<PackageReference Include="MongoDB.Driver" Version="2.17.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="MongoDB.Driver" Version="2.17.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GrpcShared\GrpcShared.csproj" />
<ProjectReference Include="..\NemAnBlazor\NemAnBlazor.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GrpcShared\GrpcShared.csproj" />
</ItemGroup>

</Project>

+ 0
- 2
IdentityProvider/Program.cs Ver fichero

@@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
using ProtoBuf.Grpc.Server;
using Microsoft.Extensions.Options;
using GrpcShared.DTO.Auth;
using Blazored.LocalStorage;
using IdentityProvider.Models;
using IdentityProvider.Services;

@@ -32,7 +31,6 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services.AddGrpc();
builder.Services.AddCodeFirstGrpc();
builder.Services.AddCodeFirstGrpcReflection();
builder.Services.AddBlazoredLocalStorage();
//call spotify api
builder.Services.AddHttpClient();


+ 13
- 8
IdentityProvider/Properties/launchSettings.json Ver fichero

@@ -10,21 +10,26 @@
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
"SpotifyService": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"dotnetRunMessages": "true"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": false,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}

+ 21
- 0
NemAnBlazor/Dockerfile Ver fichero

@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["NemAnBlazor/NemAnBlazor.csproj", "NemAnBlazor/"]
COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"]
RUN dotnet restore "NemAnBlazor/NemAnBlazor.csproj"
COPY . .
WORKDIR "/src/NemAnBlazor"
RUN dotnet build "NemAnBlazor.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "NemAnBlazor.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NemAnBlazor.dll"]

+ 27
- 23
NemAnBlazor/NemAnBlazor.csproj Ver fichero

@@ -1,31 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<UserSecretsId>c9c56d57-3d6d-46c6-b5d4-2dee92b6c31d</UserSecretsId>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>True</Optimize>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.47.0" />
<PackageReference Include="Grpc.Net.Client.Web" Version="2.47.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.7" PrivateAssets="all" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.47.0" />
<PackageReference Include="Grpc.Net.Client.Web" Version="2.47.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.7" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.7" PrivateAssets="all" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GrpcShared\GrpcShared.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GrpcShared\GrpcShared.csproj" />
</ItemGroup>

</Project>

+ 7
- 1
NemAnBlazor/Properties/launchSettings.json Ver fichero

@@ -10,7 +10,13 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}


+ 23
- 0
SpotifyService/Dockerfile Ver fichero

@@ -0,0 +1,23 @@
#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
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["SpotifyService/SpotifyService.csproj", "SpotifyService/"]
COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"]
RUN dotnet restore "SpotifyService/SpotifyService.csproj"
COPY . .
WORKDIR "/src/SpotifyService"
RUN dotnet build "SpotifyService.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SpotifyService.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SpotifyService.dll"]

+ 0
- 2
SpotifyService/HttpUtils/HttpUtils.cs Ver fichero

@@ -1,9 +1,7 @@
using Grpc.Core;
using Grpc.Net.Client;
using GrpcShared.DTO.Db;
using GrpcShared.Interfaces;
using Microsoft.Net.Http.Headers;
using NemAnBlazor.Services.Interfaces;
using Newtonsoft.Json;

namespace SpotifyService.HttpUtils

+ 0
- 6
SpotifyService/Program.cs Ver fichero

@@ -1,13 +1,9 @@
using Microsoft.AspNetCore.Server.Kestrel.Core;
using NemAnBlazor.Services.Interfaces;
using NemAnBlazor.Services;
using ProtoBuf.Grpc.Server;
using SpotifyService.Services;
using GrpcShared.Interfaces;
using Polly;
using Polly.Extensions.Http;
using GrpcShared.DTO.Auth;
using IdentityProvider.Services;

var builder = WebApplication.CreateBuilder(args);

@@ -89,7 +85,6 @@ builder.Services.AddCodeFirstGrpc();
builder.Services.AddCodeFirstGrpcReflection();
builder.Services.Configure<CodeRequest>(builder.Configuration.GetSection("AuthParams"));

builder.Services.AddScoped<IIdentityService, IdentityService>();
builder.Services.AddScoped<IAuthService, AuthService>();

var app = builder.Build();
@@ -126,7 +121,6 @@ app.MapControllers();
app.MapGrpcService<AuthService>().EnableGrpcWeb();
app.MapGrpcService<TrackService>().EnableGrpcWeb();
app.MapGrpcService<StatsService>().EnableGrpcWeb();
app.MapGrpcService<IdentityService>().EnableGrpcWeb();


app.MapCodeFirstGrpcReflectionService();

+ 15
- 8
SpotifyService/Properties/launchSettings.json Ver fichero

@@ -1,4 +1,4 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
@@ -11,20 +11,27 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
"SpotifyService": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"dotnetRunMessages": "true"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": false,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
}

+ 0
- 1
SpotifyService/Services/AuthService.cs Ver fichero

@@ -1,5 +1,4 @@
//using IdentityProvider.Protos.AuthService;
using Blazored.LocalStorage;
using Grpc.Core;
using Grpc.Net.Client;
using GrpcShared;

+ 4
- 2
SpotifyService/Services/StatsService.cs Ver fichero

@@ -1,10 +1,12 @@

using Grpc.Net.Client;
using GrpcShared.DTO;
using GrpcShared.DTO.TopItem;
using GrpcShared.DTO.Track;
using GrpcShared.Interfaces;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;
using ProtoBuf.Grpc.Client;
using SpotifyService.HttpUtils;

namespace SpotifyService.Services
@@ -14,10 +16,10 @@ namespace SpotifyService.Services
private readonly IHttpClientFactory _httpClientFactory;
private IIdentityService _identityService;
private IAuthService _authService;
public StatsService(IHttpClientFactory httpClientFactory, IIdentityService identityService, IAuthService authService)
public StatsService(IHttpClientFactory httpClientFactory, IAuthService authService)
{
_httpClientFactory = httpClientFactory;
_identityService = identityService;
_identityService = GrpcChannel.ForAddress("http://127.0.0.1:5002/").CreateGrpcService<IIdentityService>();
_authService = authService;
}


+ 4
- 3
SpotifyService/Services/TrackService.cs Ver fichero

@@ -1,5 +1,6 @@
using Google.Rpc;
using Grpc.Core;
using Grpc.Net.Client;
using GrpcShared;
using GrpcShared.DTO;
using GrpcShared.DTO.Search;
@@ -10,8 +11,8 @@ using GrpcShared.DTO.TrackByID;
using GrpcShared.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Net.Http.Headers;
using NemAnBlazor.Services;
using Newtonsoft.Json;
using ProtoBuf.Grpc.Client;
using System.Text;
using System.Text.Json;
using System.Web;
@@ -25,10 +26,10 @@ namespace SpotifyService.Services
private IIdentityService _identityService;
private IAuthService _authService;

public TrackService(IHttpClientFactory httpClientFactory, IIdentityService identityService, IAuthService authService)
public TrackService(IHttpClientFactory httpClientFactory, IAuthService authService)
{
_httpClientFactory = httpClientFactory;
_identityService = identityService;
_identityService = GrpcChannel.ForAddress("http://127.0.0.1:5002/").CreateGrpcService<IIdentityService>();
_authService = authService;
}
public async Task<SearchResponse> ListSearchAsync(SearchRequest request)

+ 25
- 23
SpotifyService/SpotifyService.csproj Ver fichero

@@ -1,29 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>c9c56d57-3d6d-46c6-b5d4-2dee92b6c31d</UserSecretsId>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Api.CommonProtos" Version="2.6.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Api.CommonProtos" Version="2.6.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.8" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GrpcShared\GrpcShared.csproj" />
<ProjectReference Include="..\IdentityProvider\IdentityProvider.csproj" />
<ProjectReference Include="..\NemAnBlazor\NemAnBlazor.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GrpcShared\GrpcShared.csproj" />
</ItemGroup>

</Project>

+ 23
- 0
SpotifyWorker/Dockerfile Ver fichero

@@ -0,0 +1,23 @@
#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/runtime:6.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["SpotifyWorker/SpotifyWorker.csproj", "SpotifyWorker/"]
COPY ["IdentityProvider/IdentityProvider.csproj", "IdentityProvider/"]
COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"]
COPY ["SpotifyService/SpotifyService.csproj", "SpotifyService/"]
RUN dotnet restore "SpotifyWorker/SpotifyWorker.csproj"
COPY . .
WORKDIR "/src/SpotifyWorker"
RUN dotnet build "SpotifyWorker.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SpotifyWorker.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SpotifyWorker.dll"]

+ 0
- 4
SpotifyWorker/Program.cs Ver fichero

@@ -1,7 +1,3 @@
using Grpc.Net.Client;
using Grpc.Net.Client.Web;
using GrpcShared.Interfaces;
using SpotifyService.Services;
using SpotifyWorker;



+ 7
- 4
SpotifyWorker/Properties/launchSettings.json Ver fichero

@@ -1,11 +1,14 @@
{
{
"profiles": {
"SpotifyWorker": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true
},
"Docker": {
"commandName": "Docker"
}
}
}
}

+ 26
- 22
SpotifyWorker/SpotifyWorker.csproj Ver fichero

@@ -1,27 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-SpotifyWorker-32F09870-7D1D-49C3-A41E-BCD7B23F1454</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-SpotifyWorker-32F09870-7D1D-49C3-A41E-BCD7B23F1454</UserSecretsId>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.21.5" />
<PackageReference Include="Grpc" Version="2.46.3" />
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.48.0" />
<PackageReference Include="Grpc.Tools" Version="2.48.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.21.5" />
<PackageReference Include="Grpc" Version="2.46.3" />
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.48.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.48.0" />
<PackageReference Include="Grpc.Tools" Version="2.48.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.171" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SpotifyService\SpotifyService.csproj" />
<ProjectReference Include="..\IdentityProvider\IdentityProvider.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SpotifyService\SpotifyService.csproj" />
<ProjectReference Include="..\IdentityProvider\IdentityProvider.csproj" />
</ItemGroup>
</Project>

+ 14
- 0
docker-compose.dcproj Ver fichero

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>

+ 29
- 0
docker-compose.yml Ver fichero

@@ -0,0 +1,29 @@
version: '3.4'

services:

spotifyworker:
image: ${DOCKER_REGISTRY-}spotifyworker
build:
context: .
dockerfile: SpotifyWorker/Dockerfile
web:
image: ${DOCKER_REGISTRY-}nemanblazor
build:
context: .
dockerfile: NemAnBlazor/Dockerfile
spotifyservice:
image: ${DOCKER_REGISTRY-}spotifyservice
build:
context: .
dockerfile: SpotifyService/Dockerfile
identityprovider:
image: ${DOCKER_REGISTRY-}identityprovider
build:
context: .
dockerfile: IdentityProvider/Dockerfile


Cargando…
Cancelar
Guardar