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..19d8116 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -12,10 +12,10 @@ 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: 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,8 +36,8 @@ jobs: run: | echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" - sender-tick: - name: Build and push sender (tick) image + sender: + 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,100 +59,7 @@ jobs: with: registry: docker.io/paritytech image: stps-sender - 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 }}" - - 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 + tags: sender-latest username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -160,126 +67,3 @@ jobs: 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..2685d92 100644 --- a/utils/dockerfiles/Dockerfile.funder +++ b/utils/dockerfiles/Dockerfile.funder @@ -1,17 +1,19 @@ -FROM rust:latest as builder +FROM rust:latest AS builder COPY . /build -WORKDIR /build/utils/funder +WORKDIR /build + +RUN cargo build --release -p funder + +FROM ubuntu:latest ARG VCS_REF ARG BUILD_DATE -RUN cargo build --release - -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/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" \ @@ -20,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 f465879..1f062bd 100644 --- a/utils/dockerfiles/Dockerfile.sender +++ b/utils/dockerfiles/Dockerfile.sender @@ -1,20 +1,19 @@ -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 +RUN cargo build --release -p sender -ENV FEATURE=${CHAIN} +FROM ubuntu:latest -RUN cargo build --features=$FEATURE --release +ARG VCS_REF +ARG BUILD_DATE -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" \ @@ -23,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/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" ] 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