diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -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 \ No newline at end of file diff --git a/Inspector/Inspector.csproj b/Inspector/Inspector.csproj index 8d3363d..9f247b5 100644 --- a/Inspector/Inspector.csproj +++ b/Inspector/Inspector.csproj @@ -22,7 +22,7 @@ - + diff --git a/Roadie.Api.Library.Tests/Roadie.Library.Tests.csproj b/Roadie.Api.Library.Tests/Roadie.Library.Tests.csproj index b1901b4..7c5cf74 100644 --- a/Roadie.Api.Library.Tests/Roadie.Library.Tests.csproj +++ b/Roadie.Api.Library.Tests/Roadie.Library.Tests.csproj @@ -23,8 +23,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all diff --git a/Roadie.Api.Library/Engines/ArtistLookupEngine.cs b/Roadie.Api.Library/Engines/ArtistLookupEngine.cs index 5e11e1f..de53bad 100644 --- a/Roadie.Api.Library/Engines/ArtistLookupEngine.cs +++ b/Roadie.Api.Library/Engines/ArtistLookupEngine.cs @@ -239,6 +239,22 @@ namespace Roadie.Library.Engines }; } + // See if roadie.json file exists in the metadata files folder, if so then use artist data from that + string releaseRoadieDataFilename = null; + try + { + releaseRoadieDataFilename = Path.Combine(Path.GetDirectoryName(metaData.Filename), "roadie.artist.json"); + } + catch (Exception) + { + } + + if (!string.IsNullOrEmpty(releaseRoadieDataFilename) && File.Exists(releaseRoadieDataFilename)) + { + var artistFromJson = CacheManager.CacheSerializer.Deserialize(File.ReadAllText(releaseRoadieDataFilename)); + artistName = artistFromJson?.Name; + } + var artist = (await DatabaseQueryForArtistName(artistName).ConfigureAwait(false)).FirstOrDefault(); sw.Stop(); if (artist?.IsValid != true) @@ -247,16 +263,6 @@ namespace Roadie.Library.Engines if (doFindIfNotInDatabase) { OperationResult artistSearch = null; - - // See if roadie.json file exists in the metadata files folder, if so then use artist data from that - string releaseRoadieDataFilename = null; - try - { - releaseRoadieDataFilename = Path.Combine(Path.GetDirectoryName(metaData.Filename), "roadie.artist.json"); - } - catch (Exception) - { - } if (!string.IsNullOrEmpty(releaseRoadieDataFilename) && File.Exists(releaseRoadieDataFilename)) { artist = CacheManager.CacheSerializer.Deserialize(File.ReadAllText(releaseRoadieDataFilename)); diff --git a/Roadie.Api.Library/Roadie.Library.csproj b/Roadie.Api.Library/Roadie.Library.csproj index c20b4b3..3b94e40 100644 --- a/Roadie.Api.Library/Roadie.Library.csproj +++ b/Roadie.Api.Library/Roadie.Library.csproj @@ -9,40 +9,40 @@ - - - + + + - - + + - - - - + + + + - + - - + + - - + + - + diff --git a/Roadie.Api.Services/Roadie.Api.Services.csproj b/Roadie.Api.Services/Roadie.Api.Services.csproj index bb872e3..d6affec 100644 --- a/Roadie.Api.Services/Roadie.Api.Services.csproj +++ b/Roadie.Api.Services/Roadie.Api.Services.csproj @@ -7,10 +7,10 @@ - + - + diff --git a/Roadie.Api/Dockerfile b/Roadie.Api/Dockerfile new file mode 100644 index 0000000..bc12a1d --- /dev/null +++ b/Roadie.Api/Dockerfile @@ -0,0 +1,26 @@ +#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/core/aspnet:3.1-buster-slim AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build +WORKDIR /src +COPY ["Roadie.Api/Roadie.Api.csproj", "Roadie.Api/"] +COPY ["Roadie.Api.Services/Roadie.Api.Services.csproj", "Roadie.Api.Services/"] +COPY ["Roadie.Api.Library/Roadie.Library.csproj", "Roadie.Api.Library/"] +COPY ["Roadie.Dlna/Roadie.Dlna.csproj", "Roadie.Dlna/"] +COPY ["Roadie.Api.Hubs/Roadie.Api.Hubs.csproj", "Roadie.Api.Hubs/"] +COPY ["Roadie.Dlna.Services/Roadie.Dlna.Services.csproj", "Roadie.Dlna.Services/"] +RUN dotnet restore "Roadie.Api/Roadie.Api.csproj" +COPY . . +WORKDIR "/src/Roadie.Api" +RUN dotnet build "Roadie.Api.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Roadie.Api.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Roadie.Api.dll"] \ No newline at end of file diff --git a/Roadie.Api/Properties/launchSettings.json b/Roadie.Api/Properties/launchSettings.json index e942ed4..21140b4 100644 --- a/Roadie.Api/Properties/launchSettings.json +++ b/Roadie.Api/Properties/launchSettings.json @@ -6,6 +6,11 @@ "ASPNETCORE_ENVIRONMENT": "Production" }, "applicationUrl": "http://localhost:5123/" + }, + "Docker": { + "commandName": "Docker", + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true } } } \ No newline at end of file diff --git a/Roadie.Api/Roadie.Api.csproj b/Roadie.Api/Roadie.Api.csproj index ac9774e..917fa5f 100644 --- a/Roadie.Api/Roadie.Api.csproj +++ b/Roadie.Api/Roadie.Api.csproj @@ -10,6 +10,7 @@ AnyCPU;x64 3f484b72-52aa-42ae-938d-4635f9511319 1.1.3 + Linux @@ -29,16 +30,17 @@ - - - - + + + + - - - + + + + @@ -50,7 +52,7 @@ - +