diff --git a/Docker/Alpine.dotNET.Dockerfile b/Docker/Alpine.dotNET.Dockerfile index 44a6a34d..e2bba28e 100644 --- a/Docker/Alpine.dotNET.Dockerfile +++ b/Docker/Alpine.dotNET.Dockerfile @@ -48,43 +48,15 @@ COPY ./PlexCleaner/. ./PlexCleaner/. ENV DOTNET_ROLL_FORWARD=Major \ DOTNET_ROLL_FORWARD_PRE_RELEASE=1 -# Run unit tests -RUN dotnet test ./PlexCleanerTests/PlexCleanerTests.csproj; - -# Build release and debug builds -RUN dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --arch $TARGETARCH \ - --self-contained false \ - --output ./Build/Release \ - --configuration release \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION \ - && dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --arch $TARGETARCH \ - --self-contained false \ - --output ./Build/Debug \ - --configuration debug \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION - -# Copy build output -RUN mkdir -p ./Publish/PlexCleaner\Debug \ - && mkdir -p ./Publish/PlexCleaner\Release \ - && if [ "$BUILD_CONFIGURATION" = "Debug" ] || [ "$BUILD_CONFIGURATION" = "debug" ]; \ - then \ - cp -r ./Build/Debug ./Publish/PlexCleaner; \ - else \ - cp -r ./Build/Release ./Publish/PlexCleaner; \ - fi \ - && cp -r ./Build/Release ./Publish/PlexCleaner/Release \ - && cp -r ./Build/Debug ./Publish/PlexCleaner/Debug +# Unit Test +COPY ./Docker/UnitTest.sh ./ +RUN chmod ugo+rwx ./UnitTest.sh +RUN ./UnitTest.sh +# Build +COPY ./Docker/Build.sh ./ +RUN chmod ugo+rwx ./Build.sh +RUN ./Build.sh # Final layer @@ -145,10 +117,10 @@ COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test # Copy version script -COPY /Docker/Version.sh /PlexCleaner +COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh -# Print installed version information +# Print version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ diff --git a/Docker/Arch.Dockerfile b/Docker/Arch.Dockerfile index e594e9c7..a350054f 100644 --- a/Docker/Arch.Dockerfile +++ b/Docker/Arch.Dockerfile @@ -39,41 +39,15 @@ COPY ./Samples/. ./Samples/. COPY ./PlexCleanerTests/. ./PlexCleanerTests/. COPY ./PlexCleaner/. ./PlexCleaner/. -# Run unit tests -RUN dotnet test ./PlexCleanerTests/PlexCleanerTests.csproj; - -# Build release and debug builds -RUN dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --self-contained false \ - --output ./Build/Release \ - --configuration release \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION \ - && dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --self-contained false \ - --output ./Build/Debug \ - --configuration debug \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION - -# Copy build output -RUN mkdir -p ./Publish/PlexCleaner\Debug \ - && mkdir -p ./Publish/PlexCleaner\Release \ - && if [ "$BUILD_CONFIGURATION" = "Debug" ] || [ "$BUILD_CONFIGURATION" = "debug" ]; \ - then \ - cp -r ./Build/Debug ./Publish/PlexCleaner; \ - else \ - cp -r ./Build/Release ./Publish/PlexCleaner; \ - fi \ - && cp -r ./Build/Release ./Publish/PlexCleaner/Release \ - && cp -r ./Build/Debug ./Publish/PlexCleaner/Debug +# Unit Test +COPY ./Docker/UnitTest.sh ./ +RUN chmod ugo+rwx ./UnitTest.sh +RUN ./UnitTest.sh +# Build +COPY ./Docker/Build.sh ./ +RUN chmod ugo+rwx ./Build.sh +RUN ./Build.sh # Final layer @@ -140,10 +114,10 @@ COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test # Copy version script -COPY /Docker/Version.sh /PlexCleaner +COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh -# Print installed version information +# Print version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ diff --git a/Docker/Build.sh b/Docker/Build.sh new file mode 100644 index 00000000..0f631697 --- /dev/null +++ b/Docker/Build.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Echo commands +set -x + +# Exit on error +set -e + +# Build release and debug builds +dotnet publish ./PlexCleaner/PlexCleaner.csproj \ + --arch $TARGETARCH \ + --self-contained false \ + --output ./Build/Release \ + --configuration release \ + -property:Version=$BUILD_VERSION \ + -property:FileVersion=$BUILD_FILE_VERSION \ + -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ + -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ + -property:PackageVersion=$BUILD_PACKAGE_VERSION + +dotnet publish ./PlexCleaner/PlexCleaner.csproj \ + --arch $TARGETARCH \ + --self-contained false \ + --output ./Build/Debug \ + --configuration debug \ + -property:Version=$BUILD_VERSION \ + -property:FileVersion=$BUILD_FILE_VERSION \ + -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ + -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ + -property:PackageVersion=$BUILD_PACKAGE_VERSION + +# Copy build output +mkdir -p ./Publish/PlexCleaner/Debug +mkdir -p ./Publish/PlexCleaner/Release +if [ "$BUILD_CONFIGURATION" = "Debug" ] || [ "$BUILD_CONFIGURATION" = "debug" ] +then + cp -r ./Build/Debug/* ./Publish/PlexCleaner +else + cp -r ./Build/Release/* ./Publish/PlexCleaner +fi +cp -r ./Build/Debug/* ./Publish/PlexCleaner/Debug +cp -r ./Build/Release/* ./Publish/PlexCleaner/Release +ls -la ./Publish/PlexCleaner diff --git a/Docker/Debian.dotNET.Dockerfile b/Docker/Debian.dotNET.Dockerfile index 12261d11..f5025e2c 100644 --- a/Docker/Debian.dotNET.Dockerfile +++ b/Docker/Debian.dotNET.Dockerfile @@ -66,43 +66,15 @@ COPY ./PlexCleaner/. ./PlexCleaner/. ENV DOTNET_ROLL_FORWARD=Major \ DOTNET_ROLL_FORWARD_PRE_RELEASE=1 -# Run unit tests -RUN dotnet test ./PlexCleanerTests/PlexCleanerTests.csproj; - -# Build release and debug builds -RUN dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --arch $TARGETARCH \ - --self-contained false \ - --output ./Build/Release \ - --configuration release \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION \ - && dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --arch $TARGETARCH \ - --self-contained false \ - --output ./Build/Debug \ - --configuration debug \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION - -# Copy build output -RUN mkdir -p ./Publish/PlexCleaner\Debug \ - && mkdir -p ./Publish/PlexCleaner\Release \ - && if [ "$BUILD_CONFIGURATION" = "Debug" ] || [ "$BUILD_CONFIGURATION" = "debug" ]; \ - then \ - cp -r ./Build/Debug ./Publish/PlexCleaner; \ - else \ - cp -r ./Build/Release ./Publish/PlexCleaner; \ - fi \ - && cp -r ./Build/Release ./Publish/PlexCleaner/Release \ - && cp -r ./Build/Debug ./Publish/PlexCleaner/Debug +# Unit Test +COPY ./Docker/UnitTest.sh ./ +RUN chmod ugo+rwx ./UnitTest.sh +RUN ./UnitTest.sh +# Build +COPY ./Docker/Build.sh ./ +RUN chmod ugo+rwx ./Build.sh +RUN ./Build.sh # Final layer @@ -200,10 +172,10 @@ COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test # Copy version script -COPY /Docker/Version.sh /PlexCleaner +COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh -# Print installed version information +# Print version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ diff --git a/Docker/Ubuntu.dotNET.Savoury.Dockerfile b/Docker/Ubuntu.dotNET.Savoury.Dockerfile index fd5402c2..b55afd45 100644 --- a/Docker/Ubuntu.dotNET.Savoury.Dockerfile +++ b/Docker/Ubuntu.dotNET.Savoury.Dockerfile @@ -46,43 +46,15 @@ COPY ./PlexCleaner/. ./PlexCleaner/. ENV DOTNET_ROLL_FORWARD=Major \ DOTNET_ROLL_FORWARD_PRE_RELEASE=1 -# Run unit tests -RUN dotnet test ./PlexCleanerTests/PlexCleanerTests.csproj; - -# Build release and debug builds -RUN dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --arch $TARGETARCH \ - --self-contained false \ - --output ./Build/Release \ - --configuration release \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION \ - && dotnet publish ./PlexCleaner/PlexCleaner.csproj \ - --arch $TARGETARCH \ - --self-contained false \ - --output ./Build/Debug \ - --configuration debug \ - -property:Version=$BUILD_VERSION \ - -property:FileVersion=$BUILD_FILE_VERSION \ - -property:AssemblyVersion=$BUILD_ASSEMBLY_VERSION \ - -property:InformationalVersion=$BUILD_INFORMATION_VERSION \ - -property:PackageVersion=$BUILD_PACKAGE_VERSION - -# Copy build output -RUN mkdir -p ./Publish/PlexCleaner\Debug \ - && mkdir -p ./Publish/PlexCleaner\Release \ - && if [ "$BUILD_CONFIGURATION" = "Debug" ] || [ "$BUILD_CONFIGURATION" = "debug" ]; \ - then \ - cp -r ./Build/Debug ./Publish/PlexCleaner; \ - else \ - cp -r ./Build/Release ./Publish/PlexCleaner; \ - fi \ - && cp -r ./Build/Release ./Publish/PlexCleaner/Release \ - && cp -r ./Build/Debug ./Publish/PlexCleaner/Debug +# Unit Test +COPY ./Docker/UnitTest.sh ./ +RUN chmod ugo+rwx ./UnitTest.sh +RUN ./UnitTest.sh +# Build +COPY ./Docker/Build.sh ./ +RUN chmod ugo+rwx ./Build.sh +RUN ./Build.sh # Final layer @@ -183,10 +155,10 @@ COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test # Copy version script -COPY /Docker/Version.sh /PlexCleaner +COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh -# Print installed version information +# Print version information ARG TARGETPLATFORM \ BUILDPLATFORM RUN if [ "$BUILDPLATFORM" = "$TARGETPLATFORM" ]; then \ diff --git a/Docker/UnitTest.sh b/Docker/UnitTest.sh new file mode 100644 index 00000000..8748d2aa --- /dev/null +++ b/Docker/UnitTest.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Echo commands +set -x + +# Exit on error +set -e + +# Test +dotnet test ./PlexCleanerTests/PlexCleanerTests.csproj diff --git a/PlexCleaner.sln b/PlexCleaner.sln index 78330576..4334343d 100644 --- a/PlexCleaner.sln +++ b/PlexCleaner.sln @@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{C560F5 ProjectSection(SolutionItems) = preProject Docker\Alpine.dotNET.Dockerfile = Docker\Alpine.dotNET.Dockerfile Docker\Arch.Dockerfile = Docker\Arch.Dockerfile + Docker\Build.sh = Docker\Build.sh + Docker\UnitTest.sh = Docker\UnitTest.sh Docker\Debian.dotNET.Dockerfile = Docker\Debian.dotNET.Dockerfile Docker\README.m4 = Docker\README.m4 Docker\README.md = Docker\README.md