Skip to content

Update Noble Numbat already has user ubuntu UID=1000 #190

Update Noble Numbat already has user ubuntu UID=1000

Update Noble Numbat already has user ubuntu UID=1000 #190

Workflow file for this run

name: Docker Image CI
on:
push:
branches: ["main", "dev*", "dev/*", "fix*", "fix/*"]
tags: ["*.*.*"]
jobs:
build:
strategy:
fail-fast: false
matrix:
image: [
# { ver: "6.0", arch: alpine3.17, matching: "6.0" },
{
ver: "6.0",
arch: alpine3.18,
matching: "6.0",
tags: "6.0-alpine3.18",
},
{
ver: "6.0",
arch: alpine3.19,
matching: "6.0",
tags: "6.0-alpine3.19,6.0-alpine,latest",
},
{
ver: "6.0",
arch: bullseye-slim,
matching: "6.0",
tags: "6.0-bullseye-slim",
},
{
ver: "6.0",
arch: bookworm-slim,
matching: "6.0",
tags: "6.0-bookworm-slim",
},
{ ver: "6.0", arch: focal, matching: "6.0", tags: "6.0-focal" },
{ ver: "6.0", arch: jammy, matching: "6.0", tags: "6.0-jammy" },
# { ver: "7.0", arch: alpine3.17, matching: "7.0" },
{
ver: "7.0",
arch: alpine3.18,
matching: "7.0",
tags: "7.0-alpine3.18",
},
{
ver: "7.0",
arch: alpine3.19,
matching: "7.0",
tags: "7.0-alpine,7.0-alpine3.19",
},
{
ver: "7.0",
arch: bullseye-slim,
matching: "7.0",
tags: "7.0-bullseye-slim",
},
{
ver: "7.0",
arch: bookworm-slim,
matching: "7.0",
tags: "7.0-bookworm-slim",
},
{ ver: "7.0", arch: jammy, matching: "7.0", tags: "7.0-jammy" },
{
ver: "8.0",
arch: alpine3.18,
matching: "8.0",
tags: "8.0-alpine3.18",
},
{
ver: "8.0",
arch: alpine3.19,
matching: "8.0",
tags: "8.0-alpine,8.0-alpine3.19",
},
{
ver: "8.0",
arch: bookworm-slim,
matching: "8.0",
tags: "8.0-bookworm-slim",
},
{ ver: "8.0", arch: jammy, matching: "8.0", tags: "8.0-jammy" },
{ ver: "8.0", arch: noble, matching: "8.0", tags: "8.0-noble" },
# { ver: 8.0-preview, arch: jammy-chiseled, matching: "8.0.0-preview" },
{
ver: 9.0-preview,
arch: alpine3.19,
matching: "9.0.0-preview",
tags: "9.0-alpine,9.0-alpine3.19",
},
{
ver: 9.0-preview,
arch: bookworm-slim,
matching: "9.0.0-preview",
tags: "9.0-bookworm-slim",
},
{
ver: 9.0-preview,
arch: noble,
matching: "9.0.0-preview",
tags: "9.0-noble",
},
]
name: ${{ matrix.image.ver }}-${{ matrix.image.arch }}
runs-on: ubuntu-latest
env:
ASPNET_VERSION: ${{ matrix.image.ver }}
IMAGE_TAG: ${{ matrix.image.ver }}-${{ matrix.image.arch }}
SKIP_DOCKER: "false"
IS_TAG: ${{ startsWith(github.ref, 'refs/tags/') }}
IS_SEMVER_TAG: "false"
IS_MULTI_RELEASE: "false"
steps:
- name: Check Tag Ref Multi
if: ${{ env.IS_TAG == 'true' && startsWith(github.ref_name, 'release_') }}
shell: pwsh
run: |
$tagRaw = '${{ github.ref_name }}'.Substring('release_'.Length)
$tokens = $tagRaw -split '_'
foreach($token in $tokens) {
$isMatchVersion = $token.Contains('${{ matrix.image.ver }}')
$pattern = '^(?<version>\d+\.\d+(\.\d+)?)(-(?<preview>[a-zA-Z.]+([\-\.]?\d+)?)([\-\.].*)?)?$'
if (!$isMatchVersion) {
if ($token -match $pattern -And '${{ matrix.image.ver }}' -match $pattern) {
$configVersion = '${{ matrix.image.ver }}' -replace $pattern,'${version}'
$configPreview = '${{ matrix.image.ver }}' -replace $pattern,'${preview}'
$currentVersion = $token -replace $pattern,'${version}'
$currentPreview = $token -replace $pattern,'${preview}'
$isMatchVersion = $currentVersion.StartsWith($configVersion) -And $currentPreview.StartsWith($configPreview)
}
}
if ($isMatchVersion) {
"IS_MULTI_RELEASE=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"IS_SEMVER_TAG=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"ASPNET_VERSION=$token" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
"IMAGE_TAG=$token-${{ matrix.image.arch }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "Update $token-${{ matrix.image.arch }} for ${{ env.IMAGE_TAG }}"
}
}
- name: Check Tag Ref
if: ${{ success() && env.IS_MULTI_RELEASE != 'true' }}
run: |
SKIP_DOCKER=${{ env.SKIP_DOCKER }}
IS_SEMVER_TAG=${{ env.IS_SEMVER_TAG }}
IS_TAG=${{ env.IS_TAG }}
if [ "$IS_TAG" == 'true' ]; then
if [[ '${{ github.ref_name }}' =~ ^([0-9]+\.[0-9]+(\.[0-9]+)?(-.+)?)$ ]]; then
IS_SEMVER_TAG=true
echo "IS_SEMVER_TAG=$IS_SEMVER_TAG" >> $GITHUB_ENV
if [[ '${{ github.ref_name }}' != *'${{ matrix.image.matching }}'* ]]; then
SKIP_DOCKER=true
echo "SKIP_DOCKER=$SKIP_DOCKER" >> $GITHUB_ENV
echo "Disable docker build for SemVer config ${{ matrix.image.ver }} on ${{ github.ref_name }}"
else
echo "ASPNET_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
echo "IMAGE_TAG=${{ github.ref_name }}-${{ matrix.image.arch }}" >> $GITHUB_ENV
echo "Update SemVer ASPNET_VERSION to ${{ github.ref_name }}"
fi
fi
fi
if [ $IS_SEMVER_TAG != true ] && [ $SKIP_DOCKER != true ]; then
DOCKER_IMAGE=mcr.microsoft.com/dotnet/aspnet:$ASPNET_VERSION
docker pull $DOCKER_IMAGE
ASPNET_VERSION=$(docker inspect $DOCKER_IMAGE --format "{{ index (index .Config.Env) }}" | tr ' ' '\n' | grep ASPNET_VERSION= | sed 's/^.*=//' | sed 's/]$//')
echo "ASPNET_VERSION=$ASPNET_VERSION" >> $GITHUB_ENV
echo "IMAGE_TAG=${ASPNET_VERSION}-${{ matrix.image.arch }}" >> $GITHUB_ENV
echo "Update Non-SemVer ASPNET_VERSION to $ASPNET_VERSION"
fi
- name: Update Image Tag
if: ${{ success() && env.SKIP_DOCKER != 'true' && env.IS_SEMVER_TAG !='true' && ( contains(env.ASPNET_VERSION, '-preview.') || contains(env.ASPNET_VERSION, '-rc.') ) }}
shell: pwsh
run: |
$aspnetVersion = '${{ env.ASPNET_VERSION }}'
# 8.0.0-preview.7.23375.9
$pattern = '^(?<version>\d+\.\d+(\.\d+)?)(-(?<preview>[a-zA-Z.]+([\-\.]?\d+)?)([\-\.].*)?)?$'
if ($aspnetVersion -match $pattern) {
$newVersionImageTag = $aspnetVersion -replace $pattern,'${version}-${preview}'
$newImageTag = "$newVersionImageTag-${{ matrix.image.arch }}"
Write-Host "ASPNET Version: $aspnetVersion"
Write-Host "New IMAGE_TAG: $newImageTag"
"IMAGE_TAG=$newImageTag" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
- uses: actions/checkout@v4
if: ${{ success() && env.SKIP_DOCKER != 'true' && github.event_name != 'pull_request' }}
- name: Docker meta
id: meta
if: ${{ success() && env.SKIP_DOCKER != 'true' && github.event_name != 'pull_request' }}
uses: docker/metadata-action@v5
with:
images: netlah/aspnet-webssh
tags: |
type=match,enable=true,priority=900,prefix=,suffix=,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=sha,enable=true,priority=600,prefix=sha-,suffix=,format=short
type=ref,event=branch,priority=500,prefix=,suffix=
- name: Enabling Docker Daemon With experimental features
if: ${{ success() && env.SKIP_DOCKER != 'true' && github.event_name != 'pull_request' }}
run: |
echo 'Before update daemon.json'
sudo cat /etc/docker/daemon.json
sudo bash -c 'echo "{ "\""exec-opts"\"": ["\""native.cgroupdriver=cgroupfs"\""], "\""cgroup-parent"\"": "\""/actions_job"\"", "\""experimental"\"": true }" > /etc/docker/daemon.json'
echo 'After update daemon.json'
sudo cat /etc/docker/daemon.json
sudo systemctl restart docker.service
- name: Set up Docker Buildx
if: ${{ success() && env.SKIP_DOCKER != 'true' && github.event_name != 'pull_request' }}
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ success() && env.SKIP_DOCKER != 'true' && github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
if: ${{ success() && env.SKIP_DOCKER != 'true' && github.event_name != 'pull_request' }}
shell: pwsh
run: |
if ('${{ env.IS_SEMVER_TAG }}' -eq $true) { $repos += @('netlah/aspnet-webssh') }
$repos += @('${{ secrets.DOCKER_HUB_REPOS }}')
./docker-build.ps1 -imageTag ${{ env.IMAGE_TAG }} -dockerRepository $repos -Squash -Labels $(@'
${{ steps.meta.outputs.labels }}
'@.Trim()) -Tags '${{ matrix.image.tags }}' -Verbose