Skip to content

Commit

Permalink
Build from shared script
Browse files Browse the repository at this point in the history
  • Loading branch information
ptr727 committed Jul 21, 2023
1 parent c533d6b commit 4a2c254
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 150 deletions.
48 changes: 10 additions & 38 deletions Docker/Alpine.dotNET.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
46 changes: 10 additions & 36 deletions Docker/Arch.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
43 changes: 43 additions & 0 deletions Docker/Build.sh
Original file line number Diff line number Diff line change
@@ -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
48 changes: 10 additions & 38 deletions Docker/Debian.dotNET.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
48 changes: 10 additions & 38 deletions Docker/Ubuntu.dotNET.Savoury.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
10 changes: 10 additions & 0 deletions Docker/UnitTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# Echo commands
set -x

# Exit on error
set -e

# Test
dotnet test ./PlexCleanerTests/PlexCleanerTests.csproj
2 changes: 2 additions & 0 deletions PlexCleaner.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a2c254

Please sign in to comment.