diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..83c9da9e0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +[Bb]in/ +[Oo]bj/ diff --git a/ComponentDetection.sln b/ComponentDetection.sln index 4f0a5d4cf..9b9cfbc3a 100644 --- a/ComponentDetection.sln +++ b/ComponentDetection.sln @@ -28,6 +28,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets Directory.Packages.props = Directory.Packages.props + Dockerfile = Dockerfile EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F452E8E5-D1AB-4B67-9FFC-5974EA1A8584}" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b8717bd5c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM mcr.microsoft.com/dotnet/sdk:3.1-cbl-mariner1.0 AS build +WORKDIR /app +COPY . . +RUN dotnet publish -c Release -o out \ + -r linux-x64 \ + -p:MinVerSkip=true \ + --self-contained true \ + -p:PublishReadyToRun=false \ + -p:IncludeNativeLibrariesForSelfExtract=true \ + -p:PublishSingleFile=true \ + -p:PublishTrimmed=true \ + -p:TrimUnusedDependencies=true \ + ./src/Microsoft.ComponentDetection + +FROM mcr.microsoft.com/dotnet/runtime-deps:3.1-cbl-mariner1.0 AS runtime +WORKDIR /app +COPY --from=build /app/out ./ + +RUN tdnf install -y \ + golang \ + moby-engine \ + gradle \ + maven \ + pnpm \ + poetry \ + python + +ENTRYPOINT ["/app/Microsoft.ComponentDetection"] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs index 15b9b4aab..fce824f32 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs @@ -153,7 +153,7 @@ public async Task TestNugetDetector_ReturnsValidPaketComponent() .ExecuteDetector(); Assert.AreEqual(ProcessingResultCode.Success, scanResult.ResultCode); - // While there are 26 lines in the sample, several dependencies are identical, so there are only 11 matches. + // While there are 26 lines in the sample, several dependencies are identical, so there are only 11 matches. Assert.AreEqual(11, componentRecorder.GetDetectedComponents().Count()); }