Skip to content

Build nuitka(main) docker with python3.8 on master by @scriptxiaozi #1

Build nuitka(main) docker with python3.8 on master by @scriptxiaozi

Build nuitka(main) docker with python3.8 on master by @scriptxiaozi #1

name: nuitka builder
run-name: Build nuitka(${{ inputs.nuitka || 'main' }}) docker with python${{ inputs.python || '3.8' }} on ${{github.ref_name}} by @${{ github.actor }}
on:
push:
branches: ["master", "main"]
paths:
- 'docker/*'
- '.github/workflows/build-nuitka-dicker.yml'
workflow_dispatch:
inputs:
python:
description: 'Python version'
required: false
default: '3.8'
nuitka:
description: 'Nuitka version'
required: false
default: 'main'
permissions:
contents: read
packages: write
env:
DOCKER_IMAGE: ghcr.io/newfuture/nuitka-builder
NUITKA_VERSION: ${{ inputs.nuitka || 'main' }}
PYTHON_VERSION: ${{ inputs.python || '3.8' }}
FULL_TAG: ${{ inputs.nuitka || 'main' }}-py${{ inputs.python || '3.8' }}
jobs:
bin-builder:
timeout-minutes: 10
strategy:
matrix:
host: ['amd', 'arm',]
type: ['glibc', 'musl']
env:
platforms: >-
${{ matrix.host == 'amd' && 'linux/386,linux/amd64' ||
matrix.type == 'glibc' && 'linux/arm/v7,linux/arm64/v8' ||
'linux/arm/v6,linux/arm/v7,linux/arm64/v8' }}
environment:
name: preview
url: https://github.com/NewFuture/DDNS/pkgs/container/nuitka-builder/
runs-on: ubuntu-${{ matrix.host == 'arm' && '24.04-arm' || 'latest' }}
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ matrix.type }}.Dockerfile
platforms: ${{ env.platforms }}
target: base-builder
push: true
tags: ${{env.DOCKER_IMAGE}}:${{ matrix.type }}-${{ matrix.host }}
build-args: |
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
NUITKA_VERSION=${{ env.NUITKA_VERSION }}
docker-builder:
timeout-minutes: ${{ matrix.host == 'qemu' && 30 || 10 }}
strategy:
matrix:
include:
- host: amd
platforms: 'linux/386,linux/amd64'
- host: arm
platforms: 'linux/arm/v6,linux/arm/v7,linux/arm64/v8'
- host: qemu
platforms: 'linux/ppc64le,linux/riscv64,linux/s390x'
environment:
name: preview
url: https://github.com/NewFuture/DDNS/pkgs/container/nuitka-builder/
runs-on: ubuntu-${{ matrix.host == 'arm' && '24.04-arm' || 'latest' }}
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
if: matrix.host == 'qemu'
with:
platforms: ${{ matrix.platforms }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: ${{ matrix.platforms }}
target: base-builder
push: true
tags: ${{env.DOCKER_IMAGE}}:${{ matrix.host }}
build-args: |
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
NUITKA_VERSION=${{ env.NUITKA_VERSION }}
merge-bin-builder:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [bin-builder]
strategy:
matrix:
type: ['glibc', 'musl']
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: preview
url: https://github.com/NewFuture/DDNS/pkgs/container/nuitka-builder/
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Merge images
run: |
set -ex
docker buildx imagetools create \
--tag ${{env.DOCKER_IMAGE}}:${{matrix.type}}-${{ github.ref_name }} \
--tag ${{env.DOCKER_IMAGE}}:${{ env.FULL_TAG }}-${{matrix.type}} \
${{env.DOCKER_IMAGE}}:${{matrix.type}}-amd \
${{env.DOCKER_IMAGE}}:${{matrix.type}}-arm \
--annotation "index:org.opencontainers.image.description={{matrix.type}} Nuitka Builder Image (multi-arch)"
merge-docker-builder:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [docker-builder]
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: preview
url: https://github.com/NewFuture/DDNS/pkgs/container/nuitka-builder/
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Merge images
run: |
set -ex
docker buildx imagetools create \
--tag ${{env.DOCKER_IMAGE}} \
--tag ${{env.DOCKER_IMAGE}}:${{ github.ref_name }} \
--tag ${{env.DOCKER_IMAGE}}:${{ env.FULL_TAG }} \
${{env.DOCKER_IMAGE}}:amd \
${{env.DOCKER_IMAGE}}:arm \
${{env.DOCKER_IMAGE}}:qemu \
--annotation "index:org.opencontainers.image.description=Alpine Nuitka Builder Image (multi-arch)"