diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5538f62..e4bed5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,13 +20,13 @@ jobs: platform: ["linux/arm/v6", "linux/arm/v7", "linux/arm64/v8", "linux/386", "linux/ppc64le", "linux/amd64"] steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # 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..6e8270f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,6 @@ name: Publish Docker image permissions: contents: read - packages: write on: release: @@ -23,16 +22,16 @@ jobs: - { platform: "linux/ppc64le", internal-tag: "ppc64le" } - { platform: "linux/amd64", internal-tag: "amd64" } steps: - - name: Check out the repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 # 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 +56,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 +69,8 @@ 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 \ + --amend - name: Push the manifest run: docker manifest push docker.io/botsudo/docker-rustpython:latest - name: Inspect the manifest @@ -82,7 +82,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/v0.4.6/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 +101,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 diff --git a/README.md b/README.md index 17c1084..4d12ae0 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). diff --git a/docker/Dockerfile b/docker/Dockerfile index 173f727..94527db 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,9 +1,8 @@ -# NAME: dclong/rustpython -FROM alpine:3.17 as builder +FROM alpine:3.20 as builder WORKDIR /workdir -ARG RUST_PYTHON_VERSION="0.2.0" +ARG RUST_PYTHON_VERSION="0.3.1" 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.20 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",