diff --git a/Docker/Alpine.dotNET.Dockerfile b/Docker/Alpine.dotNET.Dockerfile index e8552807..44a6a34d 100644 --- a/Docker/Alpine.dotNET.Dockerfile +++ b/Docker/Alpine.dotNET.Dockerfile @@ -140,18 +140,17 @@ RUN apk --no-cache add \ # Copy PlexCleaner from builder layer COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner +# Copy test script +COPY /Docker/Test.sh /Test/ +RUN chmod -R ugo+rwx /Test + +# Copy version script +COPY /Docker/Version.sh /PlexCleaner +RUN chmod ugo+rwx /PlexCleaner/Version.sh + # Print installed version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ - dotnet --info; \ - ffmpeg -version; \ - HandBrakeCLI --version; \ - mediainfo --version; \ - mkvmerge --version; \ - /PlexCleaner/PlexCleaner --version; \ + /PlexCleaner/Version.sh; \ fi - -# Copy test script -COPY /Docker/Test.sh /Test/ -RUN chmod -R ugo+rwx /Test diff --git a/Docker/Arch.Dockerfile b/Docker/Arch.Dockerfile index 90ebb6da..e594e9c7 100644 --- a/Docker/Arch.Dockerfile +++ b/Docker/Arch.Dockerfile @@ -135,13 +135,17 @@ RUN echo "y\ny" | pacman --sync --noconfirm --clean --clean # Copy PlexCleaner from builder layer COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner -# Verify installed versions -RUN dotnet --info \ - && mediainfo --version \ - && mkvmerge --version \ - && ffmpeg -version \ - && /PlexCleaner/PlexCleaner --version - # Copy test script COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test + +# Copy version script +COPY /Docker/Version.sh /PlexCleaner +RUN chmod ugo+rwx /PlexCleaner/Version.sh + +# Print installed version information +ARG TARGETPLATFORM \ + BUILDPLATFORM +RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ + /PlexCleaner/Version.sh; \ + fi diff --git a/Docker/Debian.dotNET.Dockerfile b/Docker/Debian.dotNET.Dockerfile index 5f1ee5dd..12261d11 100644 --- a/Docker/Debian.dotNET.Dockerfile +++ b/Docker/Debian.dotNET.Dockerfile @@ -195,18 +195,17 @@ RUN apt-get autoremove -y \ # Copy PlexCleaner from builder layer COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner +# Copy test script +COPY /Docker/Test.sh /Test/ +RUN chmod -R ugo+rwx /Test + +# Copy version script +COPY /Docker/Version.sh /PlexCleaner +RUN chmod ugo+rwx /PlexCleaner/Version.sh + # Print installed version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ - dotnet --info; \ - ffmpeg -version; \ - HandBrakeCLI --version; \ - mediainfo --version; \ - mkvmerge --version; \ - /PlexCleaner/PlexCleaner --version; \ + /PlexCleaner/Version.sh; \ fi - -# Copy test script -COPY /Docker/Test.sh /Test/ -RUN chmod -R ugo+rwx /Test diff --git a/Docker/Ubuntu.dotNET.Savoury.Dockerfile b/Docker/Ubuntu.dotNET.Savoury.Dockerfile index 9c857ea4..fd5402c2 100644 --- a/Docker/Ubuntu.dotNET.Savoury.Dockerfile +++ b/Docker/Ubuntu.dotNET.Savoury.Dockerfile @@ -178,18 +178,17 @@ RUN apt-get autoremove -y \ # Copy PlexCleaner from builder layer COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner +# Copy test script +COPY /Docker/Test.sh /Test/ +RUN chmod -R ugo+rwx /Test + +# Copy version script +COPY /Docker/Version.sh /PlexCleaner +RUN chmod ugo+rwx /PlexCleaner/Version.sh + # Print installed version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ - dotnet --info; \ - ffmpeg -version; \ - HandBrakeCLI --version; \ - mediainfo --version; \ - mkvmerge --version; \ - /PlexCleaner/PlexCleaner --version; \ + /PlexCleaner/Version.sh; \ fi - -# Copy test script -COPY /Docker/Test.sh /Test/ -RUN chmod -R ugo+rwx /Test diff --git a/Docker/Version.sh b/Docker/Version.sh new file mode 100644 index 00000000..5ca104ec --- /dev/null +++ b/Docker/Version.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Echo commands +set -x + +# Exit on error +set -e + +# Print version information +dotnet --info +ffmpeg -version +HandBrakeCLI --version +mediainfo --version +mkvmerge --version +/PlexCleaner/PlexCleaner --version diff --git a/PlexCleaner.sln b/PlexCleaner.sln index cb20ccbb..78330576 100644 --- a/PlexCleaner.sln +++ b/PlexCleaner.sln @@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{C560F5 Docker\README.md = Docker\README.md Docker\Test.sh = Docker\Test.sh Docker\Ubuntu.dotNET.Savoury.Dockerfile = Docker\Ubuntu.dotNET.Savoury.Dockerfile + Docker\Version.sh = Docker\Version.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{CA5B5CC1-86DF-46DB-8AEB-12CDE10FB785}" diff --git a/PlexCleaner/PlexCleaner.csproj b/PlexCleaner/PlexCleaner.csproj index f61f319c..d394c366 100644 --- a/PlexCleaner/PlexCleaner.csproj +++ b/PlexCleaner/PlexCleaner.csproj @@ -39,7 +39,7 @@ - + diff --git a/PlexCleaner/Program.cs b/PlexCleaner/Program.cs index eb371ea7..b278bdd0 100644 --- a/PlexCleaner/Program.cs +++ b/PlexCleaner/Program.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using InsaneGenius.Utilities; @@ -103,6 +104,15 @@ public static string GetVersion(bool versionOnly) return versionOnly ? version : $"{name} : {version} ({build})"; } + public static DateTime GetBuildDate() + { + // Use assembly modified time as build date + // https://stackoverflow.com/questions/1600962/displaying-the-build-date + var assembly = Assembly.GetEntryAssembly(); + assembly ??= Assembly.GetExecutingAssembly(); + return File.GetLastWriteTime(assembly.Location).ToLocalTime(); + } + private static bool ShowVersionInformation() { // Use the raw commandline and look for --version @@ -514,7 +524,10 @@ private static Program Create(CommandLineOptions options, bool verifyTools) } // Log app and runtime version - Log.Logger.Information("Application Version : {AppVersion}, Runtime Version : {RuntimeVersion}", GetVersion(false), Environment.Version.ToString()); + Log.Logger.Information("Application Version : {AppVersion}", GetVersion(false)); + Log.Logger.Information("Runtime Version : {RuntimeVersion}", RuntimeInformation.FrameworkDescription); + Log.Logger.Information("OS Version : {OsVersion}", RuntimeInformation.OSDescription); + Log.Logger.Information("Build Date : {BuildDate}", GetBuildDate().ToLocalTime()); // Parallel processing config if (Options.Parallel)