diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5538f62..dc7818b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,16 +17,16 @@ jobs: fail-fast: false max-parallel: 4 matrix: - platform: ["linux/arm/v6", "linux/arm/v7", "linux/arm64/v8", "linux/386", "linux/ppc64le", "linux/amd64"] + platform: ["linux/arm/v6", "linux/arm/v7", "linux/arm64/v8", "linux/386", "linux/ppc64le", "linux/amd64", "linux/riscv64"] steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v6 # https://github.com/docker/setup-qemu-action - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build docker image run: make docker-build env: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index da6abee..5b0499c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,12 +2,14 @@ name: Publish Docker image permissions: contents: read - packages: write on: release: types: [released] +env: + HUB_TOOL_VERSION: 0.4.6 + jobs: build-image: runs-on: ubuntu-latest @@ -22,17 +24,18 @@ jobs: - { platform: "linux/386", internal-tag: "386" } - { platform: "linux/ppc64le", internal-tag: "ppc64le" } - { platform: "linux/amd64", internal-tag: "amd64" } + - { platform: "linux/riscv64", internal-tag: "riscv64" } steps: - - name: Check out the repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v6 # https://github.com/docker/setup-qemu-action - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: docker.io username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} @@ -57,7 +60,7 @@ jobs: name: Create the image manifest steps: - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: docker.io username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} @@ -70,7 +73,9 @@ jobs: docker.io/botsudo/docker-rustpython:arm64v8-latest \ docker.io/botsudo/docker-rustpython:386-latest \ docker.io/botsudo/docker-rustpython:ppc64le-latest \ - docker.io/botsudo/docker-rustpython:amd64-latest + docker.io/botsudo/docker-rustpython:amd64-latest \ + docker.io/botsudo/docker-rustpython:riscv64-latest \ + --amend - name: Push the manifest run: docker manifest push docker.io/botsudo/docker-rustpython:latest - name: Inspect the manifest @@ -82,7 +87,7 @@ jobs: steps: - name: Install Docker hub-tool run: | - curl -sL https://github.com/docker/hub-tool/releases/download/v0.4.5/hub-tool-linux-amd64.tar.gz -o hub-tool-linux.tar.gz + curl -sL https://github.com/docker/hub-tool/releases/download/v${{ env.HUB_TOOL_VERSION }}/hub-tool-linux-amd64.tar.gz -o hub-tool-linux.tar.gz tar --strip-components=1 -xzf ./hub-tool-linux.tar.gz ./hub-tool --version - name: Login hub-tool @@ -101,7 +106,7 @@ jobs: env: DOCKER_USERNAME: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} DOCKER_PASSWORD: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} - - name: Remove PR container image via hub-tool + - name: Remove the temporary images via hub-tool run: | ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:armv6-latest || true ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:armv7-latest || true @@ -109,6 +114,7 @@ jobs: ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:386-latest || true ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:ppc64le-latest || true ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:amd64-latest || true + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:riscv64-latest || true ./hub-tool tag ls --verbose docker.io/botsudo/docker-rustpython - name: Logout hub-tool if: always() diff --git a/README.md b/README.md index 17c1084..8ff122a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # A docker rustpython image -This is a Docker image for the RustPython project. +This is a Docker image for the [RustPython](https://github.com/RustPython/RustPython#readme) project. It had the default feature flags + `freeze-stdlib`. You can find it on [Docker Hub](https://hub.docker.com/r/botsudo/docker-rustpython) and the sources on [GitHub](https://github.com/sudo-bot/docker-rustpython). @@ -32,6 +32,7 @@ We support as much as possible, the list is: - `linux/arm/v7` - `linux/arm64/v8` - `linux/ppc64le` +- `linux/riscv64` For `linux/s390x`, it needs fixing: - See: https://github.com/nix-rust/nix/issues/1968 diff --git a/docker/Dockerfile b/docker/Dockerfile index 173f727..000fc8e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,9 +1,8 @@ -# NAME: dclong/rustpython -FROM alpine:3.17 as builder +FROM alpine:3.23 as builder WORKDIR /workdir -ARG RUST_PYTHON_VERSION="0.2.0" +ARG RUST_PYTHON_VERSION="2025-11-10-main-55" ARG BUILD_DATE ARG VCS_REF @@ -13,36 +12,26 @@ ENV CARGO_INSTALL_ROOT="/workdir" # See: https://github.com/rust-lang/cargo/issues/6513#issuecomment-1440029221 ENV CARGO_NET_GIT_FETCH_WITH_CLI=true -# Newer rust needed due to let...else feature -RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community rust cargo - -RUN apk --no-cache add musl-dev git - -ADD https://github.com/RustPython/RustPython/archive/refs/tags/v$RUST_PYTHON_VERSION.tar.gz /tmp/v$RUST_PYTHON_VERSION.tar.gz -ADD https://github.com/RustPython/__doc__/archive/d927debd491e4c45b88e953e6e50e4718e0f2965.tar.gz /tmp/rp__doc__.tar.gz - -# See: https://github.com/RustPython/RustPython/pull/4499 -ADD https://github.com/RustPython/RustPython/commit/9cac89347e2276fcb309f108561e99f4be5baff2.patch /tmp/9cac89347e2276fcb309f108561e99f4be5baff2.patch - -RUN mkdir /workdir/rp__doc__/ && tar --strip-components=1 -C /workdir/rp__doc__/ -xzf /tmp/rp__doc__.tar.gz +ADD https://github.com/RustPython/RustPython/archive/refs/tags/$RUST_PYTHON_VERSION.tar.gz /tmp/v$RUST_PYTHON_VERSION.tar.gz RUN tar --strip-components=1 -C /workdir -xzf /tmp/v$RUST_PYTHON_VERSION.tar.gz -RUN git apply /tmp/9cac89347e2276fcb309f108561e99f4be5baff2.patch # Remove the git mode that triggers an error on armv6 and armv7 # Ref: https://github.com/rust-lang/cargo/issues/2808 (failed to mmap. Could not write data: Out of memory; class=Os (2)) RUN sed -i 's#{ git = .*#{ path = "/workdir/rp__doc__/" }#' /workdir/derive-impl/Cargo.toml +RUN apk add --no-cache rust cargo musl-dev git + RUN cargo fetch RUN cargo build --features freeze-stdlib --release --locked --offline --bin rustpython -FROM alpine:3.17 +FROM alpine:3.23 RUN apk --no-cache add musl libgcc COPY --from=builder /workdir/target/release/rustpython /usr/local/bin/rustpython -COPY <<-EOT /usr/local/share/sbom/rustpython.spdx.json +COPY <<-"EOT" /usr/local/share/sbom/rustpython.spdx.json { "spdxVersion": "SPDX-2.3", "dataLicense": "CC0-1.0",