From 645224cfc6896025bd98c8775938b2c7be94c37f Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Fri, 19 Sep 2025 11:40:38 +0200 Subject: [PATCH 1/4] cleanup github workflows and dockerfiles --- .github/workflows/build-images-pr.yml | 34 ---- .github/workflows/build-images.yml | 222 +----------------------- utils/dockerfiles/Dockerfile.funder | 10 +- utils/dockerfiles/Dockerfile.sender | 15 +- utils/dockerfiles/Dockerfile.sender-any | 29 ---- utils/dockerfiles/Dockerfile.tps | 30 ---- 6 files changed, 16 insertions(+), 324 deletions(-) delete mode 100644 .github/workflows/build-images-pr.yml delete mode 100644 utils/dockerfiles/Dockerfile.sender-any delete mode 100644 utils/dockerfiles/Dockerfile.tps diff --git a/.github/workflows/build-images-pr.yml b/.github/workflows/build-images-pr.yml deleted file mode 100644 index 2525d30..0000000 --- a/.github/workflows/build-images-pr.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build and Publish Docker containers s0me0ne/overhaul - -on: - push: - branches: - - s0me0ne/overhaul - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - stps-sender: - name: Build docker image - runs-on: ubuntu-latest - environment: main_n_tags - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.PR_DOCKERHUB_USERNAME }} - password: ${{ secrets.PR_DOCKERHUB_PASSWORD }} - - - name: Build Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./utils/dockerfiles/Dockerfile.sender-any - push: true - tags: | - docker.io/paritypr/stps-sender:any-latest - docker.io/paritypr/stps-sender:any-${{ github.sha }} diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 7ad0497..36b0995 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -37,7 +37,7 @@ jobs: echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" sender-tick: - name: Build and push sender (tick) image + name: Build and push sender image runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -45,7 +45,7 @@ jobs: uses: redhat-actions/buildah-build@v2 with: image: stps-sender - tags: tick-latest + tags: sender-latest dockerfiles: | ./utils/dockerfiles/Dockerfile.sender build-args: | @@ -59,7 +59,7 @@ jobs: with: registry: docker.io/paritytech image: stps-sender - tags: tick-latest + tags: sender-latest username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -67,219 +67,3 @@ jobs: run: | echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - tps-tick: - name: Build and push tps (tick) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-tps - tags: tick-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.tps - build-args: | - CHAIN=tick - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-tps - tags: tick-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - - sender-versi-tick: - name: Build and push sender (versi-tick) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-sender - tags: versi-tick-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.sender - build-args: | - CHAIN=versi-tick - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-sender - tags: versi-tick-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - - sender-versi-relay: - name: Build and push sender (versi-relay) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-sender - tags: versi-relay-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.sender - build-args: | - CHAIN=versi-relay - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-sender - tags: versi-relay-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - - tps-versi-relay: - name: Build and push tps (versi-relay) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-tps - tags: versi-relay-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.tps - build-args: | - CHAIN=versi-relay - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-tps - tags: versi-relay-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - - tps-versi-tick: - name: Build and push tps (versi-tick) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-tps - tags: versi-tick-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.tps - build-args: | - CHAIN=tick - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-tps - tags: versi-tick-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - - sender-rococo: - name: Build and push sender (rococo) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-sender - tags: rococo-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.sender - build-args: | - CHAIN=rococo - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-sender - tags: rococo-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - - tps-rococo: - name: Build and push tps (rococo) image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build Image - uses: redhat-actions/buildah-build@v2 - with: - image: stps-tps - tags: rococo-latest - dockerfiles: | - ./utils/dockerfiles/Dockerfile.tps - build-args: | - CHAIN=rococo - VCS_REF=${{ github.ref }} - BUILD_DATE=${{ github.event.release.published_at }} - - - name: Push image to docker.io - id: push-to-dockerhub - uses: redhat-actions/push-to-registry@v2 - with: - registry: docker.io/paritytech - image: stps-tps - tags: rococo-latest - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Check the image - run: | - echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" \ No newline at end of file diff --git a/utils/dockerfiles/Dockerfile.funder b/utils/dockerfiles/Dockerfile.funder index 06689fd..f2658f1 100644 --- a/utils/dockerfiles/Dockerfile.funder +++ b/utils/dockerfiles/Dockerfile.funder @@ -1,15 +1,17 @@ -FROM rust:latest as builder +FROM rust:latest AS builder COPY . /build -WORKDIR /build/utils/funder +WORKDIR /build ARG VCS_REF ARG BUILD_DATE -RUN cargo build --release +RUN cargo build --release -p funder -FROM docker.io/library/ubuntu:22.04 +FROM ubuntu:latest + +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* COPY --from=builder /build/utils/funder/target/release/funder /usr/local/bin diff --git a/utils/dockerfiles/Dockerfile.sender b/utils/dockerfiles/Dockerfile.sender index f465879..83269a0 100644 --- a/utils/dockerfiles/Dockerfile.sender +++ b/utils/dockerfiles/Dockerfile.sender @@ -1,27 +1,26 @@ -FROM rust:latest as builder +FROM rust:latest AS builder COPY . /build -WORKDIR /build/utils/sender +WORKDIR /build -ARG CHAIN ARG VCS_REF ARG BUILD_DATE -ENV FEATURE=${CHAIN} +RUN cargo build --release -p sender -RUN cargo build --features=$FEATURE --release +FROM ubuntu:latest -FROM docker.io/library/ubuntu:22.04 +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* -COPY --from=builder /build/utils/sender/target/release/sender /usr/local/bin +COPY --from=builder /build/target/release/sender /usr/local/bin LABEL description="Docker image for sTPS sender binary" \ io.parity.image.authors="mattia@parity.io, devops-team@parity.io" \ io.parity.image.vendor="Parity Technologies" \ io.parity.image.description="Used to send Balances pallet Transfers from a set of pre-funded accounts" \ io.parity.image.created="${BUILD_DATE}" \ - io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender" + io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender-any" RUN useradd -m -u 1000 -U -s /bin/sh -d /sender sender diff --git a/utils/dockerfiles/Dockerfile.sender-any b/utils/dockerfiles/Dockerfile.sender-any deleted file mode 100644 index 40344f6..0000000 --- a/utils/dockerfiles/Dockerfile.sender-any +++ /dev/null @@ -1,29 +0,0 @@ -FROM rust:latest as builder - -COPY . /build - -WORKDIR /build - -ARG VCS_REF -ARG BUILD_DATE - -RUN cargo build -r -p sender - -FROM docker.io/library/ubuntu:22.04 - -RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /build/target/release/sender /usr/local/bin - -LABEL description="Docker image for sTPS sender binary" \ - io.parity.image.authors="mattia@parity.io, devops-team@parity.io" \ - io.parity.image.vendor="Parity Technologies" \ - io.parity.image.description="Used to send Balances pallet Transfers from a set of pre-funded accounts" \ - io.parity.image.created="${BUILD_DATE}" \ - io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender-any" - -RUN useradd -m -u 1000 -U -s /bin/sh -d /sender sender - -USER sender - -ENTRYPOINT [ "/usr/local/bin/sender" ] diff --git a/utils/dockerfiles/Dockerfile.tps b/utils/dockerfiles/Dockerfile.tps deleted file mode 100644 index 15323d8..0000000 --- a/utils/dockerfiles/Dockerfile.tps +++ /dev/null @@ -1,30 +0,0 @@ -FROM rust:latest as builder - -COPY . /build - -WORKDIR /build/utils/tps - -ARG CHAIN -ARG VCS_REF -ARG BUILD_DATE - -ENV FEATURE=${CHAIN} - -RUN cargo build --features=$FEATURE --release - -FROM docker.io/library/ubuntu:22.04 - -COPY --from=builder /build/utils/tps/target/release/tps /usr/local/bin - -LABEL description="Docker image for sTPS tps binary" \ - io.parity.image.authors="mattia@parity.io, devops-team@parity.io" \ - io.parity.image.vendor="Parity Technologies" \ - io.parity.image.description="Used to calculate (s)TPS" \ - io.parity.image.created="${BUILD_DATE}" \ - io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender" - -RUN useradd -m -u 1000 -U -s /bin/sh -d /tps tps - -USER tps - -ENTRYPOINT [ "/usr/local/bin/tps" ] From f871851ef661d7f33a923e217796a1aa6990e547 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Fri, 19 Sep 2025 12:03:57 +0200 Subject: [PATCH 2/4] tags in dockerfiles --- .github/workflows/build-images.yml | 6 +++--- utils/dockerfiles/Dockerfile.sender | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 36b0995..b58ded5 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -15,7 +15,7 @@ jobs: uses: redhat-actions/buildah-build@v2 with: image: stps-funder - tags: latest + tags: funder-latest dockerfiles: | ./utils/dockerfiles/Dockerfile.funder build-args: | @@ -28,7 +28,7 @@ jobs: with: registry: docker.io/paritytech image: stps-funder - tags: latest + tags: funder-latest username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -36,7 +36,7 @@ jobs: run: | echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - sender-tick: + sender: name: Build and push sender image runs-on: ubuntu-latest steps: diff --git a/utils/dockerfiles/Dockerfile.sender b/utils/dockerfiles/Dockerfile.sender index 83269a0..13764ef 100644 --- a/utils/dockerfiles/Dockerfile.sender +++ b/utils/dockerfiles/Dockerfile.sender @@ -20,7 +20,7 @@ LABEL description="Docker image for sTPS sender binary" \ io.parity.image.vendor="Parity Technologies" \ io.parity.image.description="Used to send Balances pallet Transfers from a set of pre-funded accounts" \ io.parity.image.created="${BUILD_DATE}" \ - io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender-any" + io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender" RUN useradd -m -u 1000 -U -s /bin/sh -d /sender sender From 3170c7a46d863dbbbea92d7641a931645052ffec Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Fri, 19 Sep 2025 12:28:55 +0200 Subject: [PATCH 3/4] fix dockerfiles --- utils/dockerfiles/Dockerfile.funder | 12 ++++++------ utils/dockerfiles/Dockerfile.sender | 10 +++++----- utils/dockerfiles/README.md | 8 +++++++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/utils/dockerfiles/Dockerfile.funder b/utils/dockerfiles/Dockerfile.funder index f2658f1..2685d92 100644 --- a/utils/dockerfiles/Dockerfile.funder +++ b/utils/dockerfiles/Dockerfile.funder @@ -4,16 +4,16 @@ COPY . /build WORKDIR /build -ARG VCS_REF -ARG BUILD_DATE - RUN cargo build --release -p funder FROM ubuntu:latest +ARG VCS_REF +ARG BUILD_DATE + RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* -COPY --from=builder /build/utils/funder/target/release/funder /usr/local/bin +COPY --from=builder /build/target/release/funder /usr/local/bin LABEL description="Docker image for sTPS funder binary" \ io.parity.image.authors="mattia@parity.io, devops-team@parity.io" \ @@ -22,8 +22,8 @@ LABEL description="Docker image for sTPS funder binary" \ io.parity.image.created="${BUILD_DATE}" \ io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.funder" -RUN useradd -m -u 1000 -U -s /bin/sh -d /funder funder +RUN id -u funder >/dev/null 2>&1 || useradd -m -U -s /bin/sh -d /home/funder funder USER funder -ENTRYPOINT [ "/usr/local/bin/funder" ] +ENTRYPOINT ["/usr/local/bin/funder"] diff --git a/utils/dockerfiles/Dockerfile.sender b/utils/dockerfiles/Dockerfile.sender index 13764ef..1f062bd 100644 --- a/utils/dockerfiles/Dockerfile.sender +++ b/utils/dockerfiles/Dockerfile.sender @@ -4,13 +4,13 @@ COPY . /build WORKDIR /build -ARG VCS_REF -ARG BUILD_DATE - RUN cargo build --release -p sender FROM ubuntu:latest +ARG VCS_REF +ARG BUILD_DATE + RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* COPY --from=builder /build/target/release/sender /usr/local/bin @@ -22,8 +22,8 @@ LABEL description="Docker image for sTPS sender binary" \ io.parity.image.created="${BUILD_DATE}" \ io.parity.image.source="https://github.com/paritytech/polkadot-stps/blob/${VCS_REF}/utils/dockerfiles/Dockerfile.sender" -RUN useradd -m -u 1000 -U -s /bin/sh -d /sender sender +RUN id -u sender >/dev/null 2>&1 || useradd -m -U -s /bin/sh -d /home/sender sender USER sender -ENTRYPOINT [ "/usr/local/bin/sender" ] +ENTRYPOINT ["/usr/local/bin/sender"] diff --git a/utils/dockerfiles/README.md b/utils/dockerfiles/README.md index 299de6e..a5b8178 100644 --- a/utils/dockerfiles/README.md +++ b/utils/dockerfiles/README.md @@ -4,6 +4,12 @@ These are built and published to Parity's registries on releases via a GitHub Ac It is also possible to build the images locally from the root directory in the repo as follows: +## Sender +```sh +docker buildx build --platform=linux/amd64 -f utils/dockerfiles/Dockerfile.sender -t stps-sender:local --build-arg VCS_REF="$(git rev-parse --short HEAD)" --build-arg BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" --load . ``` -$ docker build -f utils/dockerfiles/Dockerfile. --build-arg CHAIN=$FEATURE --build-arg VCS_REF=default --build-arg BUILD_DATE=default -t stps-:$FEATURE-latest . + +## Funder +```sh +docker buildx build --platform=linux/amd64 -f utils/dockerfiles/Dockerfile.funder -t stps-funder:local --build-arg VCS_REF="$(git rev-parse --short HEAD)" --build-arg BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" --load . ``` \ No newline at end of file From 4ca8d2354d61fd1ffad350fa7e4f9528f6b240b7 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Wed, 24 Sep 2025 07:50:58 +0200 Subject: [PATCH 4/4] Update build-images.yml Co-authored-by: Javier Viola <363911+pepoviola@users.noreply.github.com> --- .github/workflows/build-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index b58ded5..19d8116 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build Image - uses: redhat-actions/buildah-build@v2 + uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2.13 with: image: stps-funder tags: funder-latest