diff --git a/.github/workflows/_build.yaml b/.github/workflows/_build.yaml index 77d1f6469..277e91e2f 100644 --- a/.github/workflows/_build.yaml +++ b/.github/workflows/_build.yaml @@ -174,6 +174,12 @@ jobs: BUILD_DATE=${{ inputs.BUILD_DATE }} ${{ inputs.EXTRA_BUILD_ARGS }} + - name: Docker image compressed size + shell: bash -x -e {0} + run: | + . .github/workflows/scripts/compressed_image_size.sh + compressed_docker_size ${{ steps.final-metadata.outputs.tags }} + - name: Generate sitrep if: "!cancelled()" shell: bash -x -e {0} diff --git a/.github/workflows/_build_base.yaml b/.github/workflows/_build_base.yaml index b575ec14b..828ccf9de 100644 --- a/.github/workflows/_build_base.yaml +++ b/.github/workflows/_build_base.yaml @@ -133,7 +133,13 @@ jobs: GIT_USER_EMAIL=${{ inputs.GIT_USER_EMAIL }} BUILD_DATE=${{ inputs.BUILD_DATE }} ${{ inputs.BASE_IMAGE != 'latest' && format('BASE_IMAGE={0}', inputs.BASE_IMAGE) || '' }} - + + - name: Docker image compressed size + shell: bash -x -e {0} + run: | + . .github/workflows/scripts/docker_size.sh + dockersize ${{ steps.meta.outputs.tags }} + - name: Generate sitrep if: "!cancelled()" shell: bash -x -e {0} diff --git a/.github/workflows/_sandbox.yaml b/.github/workflows/_sandbox.yaml index 7b90b72ca..309b9a695 100644 --- a/.github/workflows/_sandbox.yaml +++ b/.github/workflows/_sandbox.yaml @@ -4,38 +4,9 @@ on: workflow_dispatch: jobs: - sandbox: - runs-on: ubuntu-22.04 - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + build-base: + uses: ./.github/workflows/_build_base.yaml + with: + ARCHITECTURE: amd64 + secrets: inherit - - name: Print usage - run: | - cat << EOF - This is an empty workflow file located in the main branch of your - repository. It serves as a testing ground for new GitHub Actions on - development branches before merging them to the main branch. By - defining and overloading this workflow on your development branch, - you can test new actions without affecting your main branch, ensuring - a smooth integration process once the changes are ready to be merged. - - Usage: - - 1. In your development branch, modify the sandbox.yml workflow file - to include the new actions you want to test. Make sure to commit - the changes to the development branch. - 2. Navigate to the 'Actions' tab in your repository, select the - '~Sandbox' workflow, and choose your development branch from the - branch dropdown menu. Click on 'Run workflow' to trigger the - workflow on your development branch. - 3. Once you have tested and verified the new actions in the Sandbox - workflow, you can incorporate them into your main workflow(s) and - merge the development branch into the main branch. Remember to - revert the changes to the sandbox.yml file in the main branch to - keep it empty for future testing. - EOF diff --git a/.github/workflows/scripts/docker_size.sh b/.github/workflows/scripts/docker_size.sh new file mode 100644 index 000000000..448a3890b --- /dev/null +++ b/.github/workflows/scripts/docker_size.sh @@ -0,0 +1,15 @@ +function dockersize() { + docker manifest inspect -v "$1" + echo "**************************" + docker manifest inspect -v "$1" \ + | jq -c 'if type == "array" then .[] else . end' + echo "**************************" + docker manifest inspect -v "$1" \ + | jq -c 'if type == "array" then .[] else . end' \ + | jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ .SchemaV2Manifest.layers[].size ] | add ) ] | join(" ")' + echo "**************************" + docker manifest inspect -v "$1" \ + | jq -c 'if type == "array" then .[] else . end' \ + | jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ .SchemaV2Manifest.layers[].size ] | add ) ] | join(" ")' \ + | numfmt --to iec --format '%.2f' --field 2 | column -t ; +}