Skip to content

Commit

Permalink
Use the current .NET 3.1, 5.0 and 6.0, to reduce the image size
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng committed Mar 27, 2024
1 parent 5c04ae7 commit a01b0f8
Showing 1 changed file with 43 additions and 41 deletions.
84 changes: 43 additions & 41 deletions .github/workflows/docker-teamcityagent-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,38 +90,38 @@ jobs:
echo "Docker compose version only: '$DOCKER_COMPOSE_VERSION'"
echo "version=$DOCKER_COMPOSE_VERSION" >> $GITHUB_OUTPUT
- name: Get .NETCore 3.1 Versions
id: dotnetcore31_vers
shell: pwsh
run: |
$dotnet_info_raw=$(docker run --rm mcr.microsoft.com/dotnet/sdk:3.1-focal dotnet --info) -join ' '
$dotnet_sdk_version=$dotnet_info_raw -replace '^.+\.NET Core SDKs installed:[^0-9]+([0-9.]+)[^0-9].*$','$1'
$aspnetcore_version=$dotnet_info_raw -replace '^.+Microsoft.AspNetCore.App\s+([0-9.]+)[^0-9.].*$','$1'
$dotnet_version=$dotnet_info_raw -replace '^.+Microsoft.NETCore.App\s+([0-9.]+)[^0-9.].*$','$1'
Write-Output "Version SDK:$dotnet_sdk_version ASP.NET:$aspnetcore_version .NETCore:$dotnet_version"
Write-Output "sdk=$dotnet_sdk_version" >> $env:GITHUB_OUTPUT
Write-Output "aspnet=$aspnetcore_version" >> $env:GITHUB_OUTPUT
Write-Output "dotnet=$dotnet_version" >> $env:GITHUB_OUTPUT
- name: Get .NET 5.0 Versions
id: dotnet5_vers
shell: pwsh
run: |
$dotnet_vers=$(docker run --rm mcr.microsoft.com/dotnet/sdk:5.0-focal sh -c 'echo $DOTNET_SDK_VERSION;echo $ASPNET_VERSION;echo $DOTNET_VERSION')
Write-Output "Version SDK:$($dotnet_vers[0]) ASP.NET:$($dotnet_vers[1]) .NETCore:$($dotnet_vers[2])"
Write-Output "sdk=$($dotnet_vers[0])" >> $env:GITHUB_OUTPUT
Write-Output "aspnet=$($dotnet_vers[1])" >> $env:GITHUB_OUTPUT
Write-Output "dotnet=$($dotnet_vers[2])" >> $env:GITHUB_OUTPUT
- name: Get .NET 6.0 Versions
id: dotnet6_vers
shell: pwsh
run: |
$dotnet_vers=$(docker run --rm mcr.microsoft.com/dotnet/sdk:6.0-focal sh -c 'echo $DOTNET_SDK_VERSION;echo $ASPNET_VERSION;echo $DOTNET_VERSION')
Write-Output "Version SDK:$($dotnet_vers[0]) ASP.NET:$($dotnet_vers[1]) .NETCore:$($dotnet_vers[2])"
Write-Output "sdk=$($dotnet_vers[0])" >> $env:GITHUB_OUTPUT
Write-Output "aspnet=$($dotnet_vers[1])" >> $env:GITHUB_OUTPUT
Write-Output "dotnet=$($dotnet_vers[2])" >> $env:GITHUB_OUTPUT
#- name: Get .NETCore 3.1 Versions
# id: dotnetcore31_vers
# shell: pwsh
# run: |
# $dotnet_info_raw=$(docker run --rm mcr.microsoft.com/dotnet/sdk:3.1-focal dotnet --info) -join ' '
# $dotnet_sdk_version=$dotnet_info_raw -replace '^.+\.NET Core SDKs installed:[^0-9]+([0-9.]+)[^0-9].*$','$1'
# $aspnetcore_version=$dotnet_info_raw -replace '^.+Microsoft.AspNetCore.App\s+([0-9.]+)[^0-9.].*$','$1'
# $dotnet_version=$dotnet_info_raw -replace '^.+Microsoft.NETCore.App\s+([0-9.]+)[^0-9.].*$','$1'
# Write-Output "Version SDK:$dotnet_sdk_version ASP.NET:$aspnetcore_version .NETCore:$dotnet_version"
# Write-Output "sdk=$dotnet_sdk_version" >> $env:GITHUB_OUTPUT
# Write-Output "aspnet=$aspnetcore_version" >> $env:GITHUB_OUTPUT
# Write-Output "dotnet=$dotnet_version" >> $env:GITHUB_OUTPUT

#- name: Get .NET 5.0 Versions
# id: dotnet5_vers
# shell: pwsh
# run: |
# $dotnet_vers=$(docker run --rm mcr.microsoft.com/dotnet/sdk:5.0-focal sh -c 'echo $DOTNET_SDK_VERSION;echo $ASPNET_VERSION;echo $DOTNET_VERSION')
# Write-Output "Version SDK:$($dotnet_vers[0]) ASP.NET:$($dotnet_vers[1]) .NETCore:$($dotnet_vers[2])"
# Write-Output "sdk=$($dotnet_vers[0])" >> $env:GITHUB_OUTPUT
# Write-Output "aspnet=$($dotnet_vers[1])" >> $env:GITHUB_OUTPUT
# Write-Output "dotnet=$($dotnet_vers[2])" >> $env:GITHUB_OUTPUT

#- name: Get .NET 6.0 Versions
# id: dotnet6_vers
# shell: pwsh
# run: |
# $dotnet_vers=$(docker run --rm mcr.microsoft.com/dotnet/sdk:6.0-focal sh -c 'echo $DOTNET_SDK_VERSION;echo $ASPNET_VERSION;echo $DOTNET_VERSION')
# Write-Output "Version SDK:$($dotnet_vers[0]) ASP.NET:$($dotnet_vers[1]) .NETCore:$($dotnet_vers[2])"
# Write-Output "sdk=$($dotnet_vers[0])" >> $env:GITHUB_OUTPUT
# Write-Output "aspnet=$($dotnet_vers[1])" >> $env:GITHUB_OUTPUT
# Write-Output "dotnet=$($dotnet_vers[2])" >> $env:GITHUB_OUTPUT

- name: Get .NET 7.0 Versions
id: dotnet7_vers
Expand Down Expand Up @@ -166,15 +166,6 @@ jobs:
build-args: |
MINVER_VERSION=${{ steps.minver_version.outputs.version }}
DOCKER_COMPOSE_VERSION=${{ steps.docker_compose_version.outputs.version }}
DOTNET_SDK_VERSION31=${{ steps.dotnetcore31_vers.outputs.sdk }}
ASPNET_VERSION31=${{ steps.dotnetcore31_vers.outputs.aspnet }}
DOTNET_VERSION31=${{ steps.dotnetcore31_vers.outputs.dotnet }}
DOTNET_SDK_VERSION5=${{ steps.dotnet5_vers.outputs.sdk }}
ASPNET_VERSION5=${{ steps.dotnet5_vers.outputs.aspnet }}
DOTNET_VERSION5=${{ steps.dotnet5_vers.outputs.dotnet }}
DOTNET_SDK_VERSION6=${{ steps.dotnet6_vers.outputs.sdk }}
ASPNET_VERSION6=${{ steps.dotnet6_vers.outputs.aspnet }}
DOTNET_VERSION6=${{ steps.dotnet6_vers.outputs.dotnet }}
DOTNET_SDK_VERSION7=${{ steps.dotnet7_vers.outputs.sdk }}
ASPNET_VERSION7=${{ steps.dotnet7_vers.outputs.aspnet }}
DOTNET_VERSION7=${{ steps.dotnet7_vers.outputs.dotnet }}
Expand All @@ -185,5 +176,16 @@ jobs:
ASPNET_VERSION9=${{ steps.dotnet9_vers.outputs.aspnet }}
DOTNET_VERSION9=${{ steps.dotnet9_vers.outputs.dotnet }}
POWERSHELL_VERSION=${{ steps.dotnet9_vers.outputs.pwsh }}
unused: |
DOTNET_SDK_VERSION31=${{ steps.dotnetcore31_vers.outputs.sdk }}
ASPNET_VERSION31=${{ steps.dotnetcore31_vers.outputs.aspnet }}
DOTNET_VERSION31=${{ steps.dotnetcore31_vers.outputs.dotnet }}
DOTNET_SDK_VERSION5=${{ steps.dotnet5_vers.outputs.sdk }}
ASPNET_VERSION5=${{ steps.dotnet5_vers.outputs.aspnet }}
DOTNET_VERSION5=${{ steps.dotnet5_vers.outputs.dotnet }}
DOTNET_SDK_VERSION6=${{ steps.dotnet6_vers.outputs.sdk }}
ASPNET_VERSION6=${{ steps.dotnet6_vers.outputs.aspnet }}
DOTNET_VERSION6=${{ steps.dotnet6_vers.outputs.dotnet }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit a01b0f8

Please sign in to comment.