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 36e68d0 commit 8fe3ec8
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 35 deletions.
59 changes: 28 additions & 31 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ jobs:
path: src/FrameworkTests/MonoConsole/bin/${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }}
if-no-files-found: error
retention-days: 1
- name: Publish test project AotConsole
uses: actions/upload-artifact@main
if: success() && (github.event_name != 'workflow_dispatch' && true || inputs.run_tests) == true
with:
name: AotConsole
path: src/FrameworkTests/AotConsole/bin/${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }}
if-no-files-found: error
retention-days: 1
test:
name: Test (${{ matrix.os }})
needs: build
Expand Down Expand Up @@ -240,12 +232,12 @@ jobs:
if-no-files-found: error
retention-days: 1
docker:
name: Test (${{ matrix.os }}; docker)
name: Docker (${{ matrix.os }})
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
if: success() && (github.event_name != 'workflow_dispatch' && true || inputs.run_docker) == true
steps:
Expand All @@ -254,33 +246,38 @@ jobs:
with:
fetch-depth: 0
sparse-checkout: |
src/FrameworkTests/AotConsole/Dockerfiles
src/PDFtoImage
src/FrameworkTests/AotConsole
src/Tests/Dockerfiles
- name: Download test project AotConsole
uses: actions/download-artifact@main
with:
name: AotConsole
path: AotConsole
- name: docker build aotconsole
shell: pwsh
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/Dockerfile .
- name: docker run aotconsole
shell: pwsh
run: docker run -t aotconsole net8.0/PDFtoImage.FrameworkTests.AotConsole.dll
- name: aotconsole linux
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/linux . && docker run --rm -t aotconsole
- name: aotconsole linux-chiseled
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/linux-chiseled . && docker run --rm -t aotconsole
- name: aotconsole linux-aot
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/linux-aot . && docker run --rm -t aotconsole
- name: aotconsole linux-aot-chiseled
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/linux-aot-chiseled . && docker run --rm -t aotconsole
- name: aotconsole windows
if: runner.os == 'Windows' && (success() || failure())
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/windows . && docker run --rm -t aotconsole
- name: aotconsole windows-aot
if: runner.os == 'Windows' && (success() || failure())
run: docker build -t aotconsole -f src/FrameworkTests/AotConsole/Dockerfiles/windows-aot . && docker run --rm -t aotconsole
- name: Download test assemblies
if: success() || failure()
uses: actions/download-artifact@main
with:
name: Test assemblies
- name: docker build test-client
id: build-test
shell: pwsh
if: success() || failure()
run: docker build -t test-client -f src/Tests/Dockerfiles/Dockerfile .
- name: docker run test-client
shell: pwsh
if: steps.build-test.conclusion == 'success'
run: docker run --rm --mount type=bind,source=${{ github.workspace }},target=/app/TestResults -t test-client net8.0/PDFtoImage.Tests.dll
- name: test-client linux
if: runner.os == 'Linux' && (success() || failure())
run: docker build -t test-client -f src/Tests/Dockerfiles/linux . && docker run --rm --mount type=bind,source=${{ github.workspace }},target=/app/TestResults -t test-client net8.0/PDFtoImage.Tests.dll
- name: test-client windows
if: runner.os == 'Windows' && (success() || failure())
run: docker build -t test-client -f src/Tests/Dockerfiles/windows . && docker run --rm --mount type=bind,source=${{ github.workspace }},target=/app/TestResults -t test-client net8.0/PDFtoImage.Tests.dll
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@main
Expand Down
1 change: 1 addition & 0 deletions src/FrameworkTests/AotConsole/AotConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>PDFtoImage.FrameworkTests.AotConsole</AssemblyName>
Expand Down
4 changes: 0 additions & 4 deletions src/FrameworkTests/AotConsole/Dockerfiles/Dockerfile

This file was deleted.

18 changes: 18 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGET_FRAMEWORK=net8.0
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=$TARGET_FRAMEWORK
COPY . .
WORKDIR "/src/src"
RUN dotnet build "./FrameworkTests/AotConsole/AotConsole.csproj" -c $BUILD_CONFIGURATION -o /app/build --no-restore

FROM base AS final
WORKDIR /app
COPY --from=build /app/build .
ENTRYPOINT ["dotnet", "PDFtoImage.FrameworkTests.AotConsole.dll"]
25 changes: 25 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/linux-aot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGET_FRAMEWORK=net8.0
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=$TARGET_FRAMEWORK
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 apt update && apt install -y \
clang \
zlib1g-dev
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"]
25 changes: 25 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/linux-aot-chiseled
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGET_FRAMEWORK=net8.0
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=$TARGET_FRAMEWORK
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 apt update && apt install -y \
clang \
zlib1g-dev
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"]
18 changes: 18 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/linux-chiseled
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/runtime:8.0-noble-chiseled AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGET_FRAMEWORK=net8.0
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=$TARGET_FRAMEWORK
COPY . .
WORKDIR "/src/src"
RUN dotnet build "./FrameworkTests/AotConsole/AotConsole.csproj" -c $BUILD_CONFIGURATION -o /app/build --no-restore

FROM base AS final
WORKDIR /app
COPY --from=build /app/build .
ENTRYPOINT ["dotnet", "PDFtoImage.FrameworkTests.AotConsole.dll"]
18 changes: 18 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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
ARG TARGET_FRAMEWORK=net8.0
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=$TARGET_FRAMEWORK
COPY . .
WORKDIR "/src/src"
RUN dotnet build "./FrameworkTests/AotConsole/AotConsole.csproj" -c $BUILD_CONFIGURATION -o /app/build --no-restore

FROM base AS final
WORKDIR /app
COPY --from=build /app/build .
ENTRYPOINT ["dotnet", "PDFtoImage.FrameworkTests.AotConsole.dll"]
22 changes: 22 additions & 0 deletions src/FrameworkTests/AotConsole/Dockerfiles/windows-aot
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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
ARG TARGET_FRAMEWORK=net8.0
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=$TARGET_FRAMEWORK
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"]
File renamed without changes.
4 changes: 4 additions & 0 deletions src/Tests/Dockerfiles/windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2022
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "test", "/logger:console;verbosity=detailed", "/logger:trx;verbosity=detailed"]

0 comments on commit 8fe3ec8

Please sign in to comment.