Skip to content

Ship a toolchain-python Docker image for cross-compilation #612

@ppenna

Description

@ppenna

Summary

Create and ship a derived Docker image that layers a specific Python version on top of ghcr.io/nanvix/toolchain-gcc, to be used as the cross-compilation environment for CPython on Nanvix.

Background

The Nanvix toolchain is migrating from nanvix/toolchain:latest-minimal (Docker Hub) to ghcr.io/nanvix/toolchain-gcc:sha-34a3641 (GHCR). The new GCC image is intentionally minimal — it contains only binutils + gcc + newlib for i686-nanvix.

However, CPython's cross-compilation requires a host Python 3 interpreter (passed via --with-build-python). The old image provided this at /opt/nanvix/bin/python3; the new GCC-only image does not.

Proposal

This repository should own and publish a derived Docker image, e.g.:

FROM ghcr.io/nanvix/toolchain-gcc:sha-34a3641

RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-dev \
    && rm -rf /var/lib/apt/lists/*

Published as: ghcr.io/nanvix/toolchain-python:<tag>

Requirements

  • Base image: ghcr.io/nanvix/toolchain-gcc (pinned to a specific tag/SHA)
  • Adds: Python 3 (matching or close to the CPython version being cross-compiled)
  • Python should be available at a predictable path (e.g., /usr/bin/python3)
  • Published to GHCR from this repo's CI

Files to Update After Image is Available

  • Makefile.nanvix — update NANVIX_DOCKER_IMAGE default and BUILD_PYTHON path
  • .nanvix/config.py — update DOCKER_IMAGE constant
  • .nanvix/env.json (if present) — update NANVIX_DOCKER_IMAGE field
  • NANVIX.md — update docker pull instructions

Notes

  • The BUILD_PYTHON path in Makefile.nanvix currently points to /opt/nanvix/bin/python3. After migration, it should point to /usr/bin/python3 (or wherever the derived image installs it).
  • This keeps the GCC toolchain image lean for all other repos while giving CPython exactly what it needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions