From 2105d316746e4bcf49d83d773cf299a542b9efb9 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 10:56:01 -0600 Subject: [PATCH 01/17] add arm64 to docker publish workflow --- .github/workflows/docker.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6b2ba6ada2..170b36cf68 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,5 @@ name: Docker Build and Push -# Build & Push builds the simapp docker image on every push to master -# and pushes the image to https://hub.docker.com/u/provenanceio + on: push: branches: @@ -9,11 +8,6 @@ on: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 -# Set concurrency for this workflow to cancel in-progress jobs if retriggered. -# The github.ref is only available when triggered by a PR so fall back to github.run_id for other cases. -# The github.run_id is unique for each run, giving each such invocation it's own unique concurrency group. -# Basically, if you push to a PR branch, jobs that are still running for that PR will be cancelled. -# But jobs started because of a merge to main or a release tag push are not cancelled. concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: true @@ -25,13 +19,16 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Setup go uses: actions/setup-go@v4 with: go-version: '1.20' + - name: Go mod vendor run: | go mod vendor + - name: Prepare id: prep run: | @@ -56,16 +53,20 @@ jobs: created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" echo "Setting output: created=$created" echo "created=$created" >> "$GITHUB_OUTPUT" + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 + - name: Available platforms run: echo ${{ steps.buildx.outputs.platforms }} + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Publish to Docker Hub uses: docker/build-push-action@v5 with: @@ -73,7 +74,7 @@ jobs: target: run build-args: | VERSION=${{ steps.prep.outputs.version }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 file: docker/blockchain/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.prep.outputs.tags }} From 388da8691168630e192278a33314d38cf83750df Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 10:58:44 -0600 Subject: [PATCH 02/17] add comments back to file --- .github/workflows/docker.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 170b36cf68..cae8de7780 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,5 +1,6 @@ name: Docker Build and Push - +# Build & Push builds the simapp docker image on every push to master +# and pushes the image to https://hub.docker.com/u/provenanceio on: push: branches: @@ -7,11 +8,15 @@ on: tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 - + +# Set concurrency for this workflow to cancel in-progress jobs if retriggered. +# The github.ref is only available when triggered by a PR so fall back to github.run_id for other cases. +# The github.run_id is unique for each run, giving each such invocation it's own unique concurrency group. +# Basically, if you push to a PR branch, jobs that are still running for that PR will be cancelled. +# But jobs started because of a merge to main or a release tag push are not cancelled. concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: true - jobs: docker: runs-on: ubuntu-latest From 307a6e67995a43c878efd907086a9eb3b8ff6541 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 11:01:56 -0600 Subject: [PATCH 03/17] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7452193f9e..f030d36f28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * Bump cometbft to v0.34.29 (from v0.34.28) [PR 1649](https://github.com/provenance-io/provenance/pull/1649). * Add genesis/init for Marker module send deny list addresses. [#1660](https://github.com/provenance-io/provenance/issues/1660) * Add automatic changelog entries for dependabot. [#1674](https://github.com/provenance-io/provenance/issues/1674) +* Add publishing of docker arm64 container builds [#1634](https://github.com/provenance-io/provenance/issues/1634) * Ensure IBC marker has matching supply [#1706](https://github.com/provenance-io/provenance/issues/1706). ### Bug Fixes From 38908cf7e41897578b1f9edfdfab8f1cca6e1168 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 12:30:23 -0600 Subject: [PATCH 04/17] temp add of my branch --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cae8de7780..e367f91cbd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 From ab008f6dec57c79d7956f2fd71e468c69c5f310b Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 12:33:22 -0600 Subject: [PATCH 05/17] remove test --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e367f91cbd..cae8de7780 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 From 76aab95d26c1333e4cdc4375157cb9215ed3d0d5 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 13:00:56 -0600 Subject: [PATCH 06/17] second attempt --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cae8de7780..e367f91cbd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 From 22a19cf0f572cd1e699cf83229f6af5b96eab4d2 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 17 Oct 2023 15:20:25 -0600 Subject: [PATCH 07/17] remove test --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e367f91cbd..cae8de7780 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 From 8e9bdfa4a051e3ddff3b1168bd0a28cf463681b2 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Wed, 18 Oct 2023 09:04:27 -0600 Subject: [PATCH 08/17] add a fix and temp publish docker from branch --- .github/workflows/docker.yml | 1 + docker/blockchain/Dockerfile | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cae8de7780..e367f91cbd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index 6fa632a18d..a70f53c09a 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -22,8 +22,11 @@ COPY Makefile sims.mk ./ # Build and install provenanced -ENV VERSION=$VERSION -RUN make VERSION=${VERSION} WITH_CLEVELDB=true install +ENV VERSION=${VERSION} +RUN UNAME_M=$(uname -m) && \ + echo "UNAME_M: ${UNAME_M}" && \ + if [ ${UNAME_M} != "x86_64" ]; then export ARCH=aarch64; fi && \ + make VERSION=${VERSION} WITH_CLEVELDB=true install ### FROM debian:bullseye-slim as run From 5a2d48f2d735c496323b47f094c959103d5a56d9 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Wed, 18 Oct 2023 09:11:47 -0600 Subject: [PATCH 09/17] better logic --- docker/blockchain/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index a70f53c09a..c09900b0c0 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -25,7 +25,7 @@ COPY Makefile sims.mk ./ ENV VERSION=${VERSION} RUN UNAME_M=$(uname -m) && \ echo "UNAME_M: ${UNAME_M}" && \ - if [ ${UNAME_M} != "x86_64" ]; then export ARCH=aarch64; fi && \ + export ARCH=${UNAME_M} && \ make VERSION=${VERSION} WITH_CLEVELDB=true install ### From b0f64c31bf9451360873901dbf5bce8d8783bb9c Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Wed, 18 Oct 2023 15:39:19 -0600 Subject: [PATCH 10/17] try setting arg another way --- docker/blockchain/Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index c09900b0c0..0af2cf4e35 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -23,14 +23,12 @@ COPY Makefile sims.mk ./ # Build and install provenanced ENV VERSION=${VERSION} -RUN UNAME_M=$(uname -m) && \ - echo "UNAME_M: ${UNAME_M}" && \ - export ARCH=${UNAME_M} && \ - make VERSION=${VERSION} WITH_CLEVELDB=true install +RUN make VERSION=${VERSION} WITH_CLEVELDB=true install ### FROM debian:bullseye-slim as run -ARG ARCH=x86_64 +RUN UNAME_M=$(uname -m) +ARG ARCH=${UNAME_M} ENV LD_LIBRARY_PATH="/usr/local/lib" RUN apt-get update && \ apt-get upgrade -y && \ From 91f169d3cffdd857d09df28f74e4089535675673 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Thu, 19 Oct 2023 10:44:00 -0600 Subject: [PATCH 11/17] remove ARCH arg from build, use uname from container to copy over correct wasm file --- Makefile | 7 ++----- docker/blockchain/Dockerfile | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 41806cf750..43282b4424 100644 --- a/Makefile +++ b/Makefile @@ -454,11 +454,8 @@ vendor: # Full build inside a docker container for a clean release build docker-build: vendor -ifeq ($(UNAME_M),x86_64) - docker build --build-arg VERSION=$(VERSION) --build-arg ARCH=$(UNAME_M) -t provenance-io/blockchain . -f docker/blockchain/Dockerfile -else - docker build --build-arg VERSION=$(VERSION) --build-arg ARCH=aarch64 -t provenance-io/blockchain . -f docker/blockchain/Dockerfile -endif + docker build --build-arg VERSION=$(VERSION) -t provenance-io/blockchain . -f docker/blockchain/Dockerfile + # Quick build using local environment and go platform target options. docker-build-local: vendor diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index 0af2cf4e35..6d3e867fe4 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -1,6 +1,5 @@ FROM golang:1.20-bullseye as build ARG VERSION -ARG ARCH=x86_64 WORKDIR /go/src/github.com/provenance-io/provenance @@ -27,18 +26,19 @@ RUN make VERSION=${VERSION} WITH_CLEVELDB=true install ### FROM debian:bullseye-slim as run -RUN UNAME_M=$(uname -m) -ARG ARCH=${UNAME_M} ENV LD_LIBRARY_PATH="/usr/local/lib" RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y curl jq libleveldb-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/ + -COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.$ARCH.so /usr/local/lib +COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.*.so /tmp COPY --from=build /go/bin/provenanced /usr/bin/provenanced +RUN cp /tmp/libwasmvm.$(uname -m).so /usr/local/lib/. + ENV PIO_HOME=/home/provenance WORKDIR /home/provenance From 5620fe1f9fb69fb31b95752849d96eb3267ab2bc Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Thu, 19 Oct 2023 10:44:32 -0600 Subject: [PATCH 12/17] remove temp wasm files --- docker/blockchain/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index 6d3e867fe4..9269d373a3 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -37,7 +37,8 @@ RUN apt-get update && \ COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.*.so /tmp COPY --from=build /go/bin/provenanced /usr/bin/provenanced -RUN cp /tmp/libwasmvm.$(uname -m).so /usr/local/lib/. +RUN cp /tmp/libwasmvm.$(uname -m).so /usr/local/lib/. && \ + rm /tmp/libwasmvm.*.so ENV PIO_HOME=/home/provenance WORKDIR /home/provenance From 3245c5668dc3da5f626d3425b9dec170d7773ddb Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Fri, 20 Oct 2023 09:31:36 -0600 Subject: [PATCH 13/17] Add arch check and error message for clarity --- docker/blockchain/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index 9269d373a3..a643de67fc 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -21,7 +21,7 @@ COPY Makefile sims.mk ./ # Build and install provenanced -ENV VERSION=${VERSION} +ENV VERSION=$VERSION RUN make VERSION=${VERSION} WITH_CLEVELDB=true install ### @@ -37,7 +37,12 @@ RUN apt-get update && \ COPY --from=build /go/src/github.com/provenance-io/provenance/vendor/github.com/CosmWasm/wasmvm/internal/api/libwasmvm.*.so /tmp COPY --from=build /go/bin/provenanced /usr/bin/provenanced -RUN cp /tmp/libwasmvm.$(uname -m).so /usr/local/lib/. && \ +RUN ARCH=$(uname -m) && \ + if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then \ + echo "Unsupported architecture (required: x86_64 or aarch64): $ARCH"; \ + exit 1; \ + fi && \ + cp /tmp/libwasmvm.$ARCH.so /usr/local/lib/. && \ rm /tmp/libwasmvm.*.so ENV PIO_HOME=/home/provenance From 9d2f9d2959ae7bf89735143bcfeb6c20eb93f70d Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Fri, 20 Oct 2023 10:49:52 -0600 Subject: [PATCH 14/17] remove custom branch from workflow --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e367f91cbd..cae8de7780 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 From 5e35d783e37478f119ad9527cbcc86a94d954982 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Mon, 30 Oct 2023 12:09:09 -0600 Subject: [PATCH 15/17] test build platform --- .github/workflows/docker.yml | 1 + docker/blockchain/Dockerfile | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cae8de7780..e367f91cbd 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index a643de67fc..8ed9099630 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -22,7 +22,9 @@ COPY Makefile sims.mk ./ # Build and install provenanced ENV VERSION=$VERSION -RUN make VERSION=${VERSION} WITH_CLEVELDB=true install +RUN ARCH=$(uname -m) && \ + echo "Building provnenace for Arch: $ARCH"; \ + make VERSION=${VERSION} WITH_CLEVELDB=true install ### FROM debian:bullseye-slim as run From 8760a8d094db83c2214b6ecaa3ab495db08c8048 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Mon, 30 Oct 2023 13:33:34 -0600 Subject: [PATCH 16/17] remove cleveldb, check build archs --- docker/blockchain/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index 8ed9099630..832d56cb5d 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -23,8 +23,12 @@ COPY Makefile sims.mk ./ # Build and install provenanced ENV VERSION=$VERSION RUN ARCH=$(uname -m) && \ - echo "Building provnenace for Arch: $ARCH"; \ - make VERSION=${VERSION} WITH_CLEVELDB=true install + if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then \ + echo "Unsupported architecture (required: x86_64 or aarch64): $ARCH"; \ + exit 1; \ + fi && \ + echo "Building and installing provenance for Arch: $ARCH"; \ + make VERSION=${VERSION} install ### FROM debian:bullseye-slim as run From 5a2949f29a7d219a6aa2ab6e60a85f195b07af8a Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 31 Oct 2023 10:17:19 -0600 Subject: [PATCH 17/17] remove branch --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e367f91cbd..cae8de7780 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - nullpointer0x00/1634-arm64-container-builds tags: - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5