Skip to content

Commit

Permalink
Update dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sungaila committed Jul 3, 2024
1 parent 029c68a commit 79b8646
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,30 @@ jobs:
- name: console (linux-aot-chiseled)
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t console -f src/FrameworkTests/AotConsole/Dockerfiles/linux-aot-chiseled . && docker run --rm -t console
- name: console (windows)
- name: console (servercore)
if: runner.os == 'Windows' && (success() || failure())
run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows" windows && docker build -t console -f windows . && docker run --rm -t console
- name: console (windows-aot)
run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-servercore" windows-servercore && docker build -t console -f windows-servercore . && docker run --rm -t console
- name: console (servercore-aot)
if: runner.os == 'Windows' && (success() || failure())
run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-aot" windows-aot && docker build -t console -f windows . && docker run --rm -t console
run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-servercore-aot" windows-servercore-aot && docker build -t console -f windows-servercore-aot . && docker run --rm -t console
- name: console (nanoserver)
if: runner.os == 'Windows' && (success() || failure())
run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-nanoserver" windows-nanoserver && docker build -t console -f windows-nanoserver . && docker run --rm -t console
- name: console (nanoserver-aot)
if: runner.os == 'Windows' && (success() || failure())
run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-nanoserver-aot" windows-nanoserver-aot && docker build -t console -f windows-nanoserver-aot . && docker run --rm -t console
- name: docker system prune
if: success() || failure()
run: docker system prune -a -f
- name: unittests (linux)
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f src/Tests/Dockerfiles/linux . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests
- name: unittests (windows)
- name: unittests (servercore)
if: runner.os == 'Windows' && (success() || failure())
run: xcopy /y "src\Tests\Dockerfiles\windows-servercore" windows-servercore && docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f windows-servercore . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests
- name: unittests (nanoserver)
if: runner.os == 'Windows' && (success() || failure())
run: xcopy /y "src\Tests\Dockerfiles\windows" windows && docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f windows . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests
run: xcopy /y "src\Tests\Dockerfiles\windows-nanoserver" windows-nanoserver && docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f windows-nanoserver . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@main
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/windows-nanoserver-aot
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2022 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/FrameworkTests/AotConsole/AotConsole.csproj", "src/FrameworkTests/AotConsole/AotConsole.csproj"]
COPY ["src/PDFtoImage", "src/PDFtoImage"]
RUN dotnet restore "./src/FrameworkTests/AotConsole/AotConsole.csproj" /p:TargetFramework=net8.0
COPY . .
WORKDIR "/src/src"
RUN dotnet build "./FrameworkTests/AotConsole/AotConsole.csproj" -c %BUILD_CONFIGURATION% -o /app/build --no-restore

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./FrameworkTests/AotConsole/AotConsole.csproj" -c %BUILD_CONFIGURATION% -o /app/publish --no-restore

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["PDFtoImage.FrameworkTests.AotConsole.exe"]
22 changes: 22 additions & 0 deletions src/Tests/Dockerfiles/windows-nanoserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2022 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGET_FRAMEWORK=net8.0
WORKDIR /src
COPY ["src/Tests/Tests.csproj", "src/Tests/Tests.csproj"]
COPY ["src/PDFtoImage", "src/PDFtoImage"]
RUN dotnet restore "./src/Tests/Tests.csproj" /p:TargetFramework=%TARGET_FRAMEWORK%
COPY . .
WORKDIR "/src/src"
RUN dotnet build "./Tests/Tests.csproj" -c %BUILD_CONFIGURATION% -o /app/build/%TARGET_FRAMEWORK% --no-restore -f %TARGET_FRAMEWORK%

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Tests/Tests.csproj" -c %BUILD_CONFIGURATION% -o /app/publish --no-restore -f %TARGET_FRAMEWORK%

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "test", "publish/PDFtoImage.Tests.dll", "/logger:console;verbosity=detailed", "/logger:trx;verbosity=detailed"]
File renamed without changes.

0 comments on commit 79b8646

Please sign in to comment.