Skip to content

Commit

Permalink
fix(tools): bring back arm64 target (#235)
Browse files Browse the repository at this point in the history
* fix(tools): bring back arm64 target

compile rocksdb in static mode

* bump docker container version

* add changelog

* build separately

* setup QEMU

* add PORTABLE flag

* install shared

* add libbz2-dev

* remove -jN

* bring back -j4

* separate Dockerfile for arm64

* remove librocksdb-dev

* setup qemu
  • Loading branch information
melekes authored Feb 7, 2025
1 parent 2d98c2d commit f9acb55
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/234-fix-arm64-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[docker]` Bring back `arm64` build target
([\#234](https://github.com/cometbft/cometbft-db/issues/234))
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Check if Docker image exists
id: check
run: |
if docker manifest inspect cometbft/cometbft-db-testing:v1.0.2 &>/dev/null; then
if docker manifest inspect cometbft/cometbft-db-testing:v1.0.3 &>/dev/null; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
Expand All @@ -30,7 +30,7 @@ jobs:
needs: check-container
if: needs.check-container.outputs.exists == 'true'
runs-on: ubuntu-latest
container: cometbft/cometbft-db-testing:v1.0.2
container: cometbft/cometbft-db-testing:v1.0.3
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -61,12 +61,23 @@ jobs:
with:
driver: docker

- name: Build Docker image
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build Docker image (arm64) to ensure it works
uses: docker/build-push-action@v6
with:
context: ./tools
file: ./tools/Dockerfile.arm64
platforms: linux/arm64

- name: Build Docker image (amd64) to be used in the next step
uses: docker/build-push-action@v6
with:
context: ./tools
file: ./tools/Dockerfile
tags: "cometbft/cometbft-db-testing:latest"
platforms: linux/amd64
load: true

- name: test & coverage report creation
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish to Docker Hub
- name: Publish to Docker Hub (amd64)
uses: docker/build-push-action@v6
with:
context: ./tools
Expand All @@ -49,3 +49,14 @@ jobs:
tags: |
cometbft/cometbft-db-testing:latest
cometbft/cometbft-db-testing:${{ github.event.inputs.refName }}
- name: Publish to Docker Hub (arm64)
uses: docker/build-push-action@v6
with:
context: ./tools
file: ./tools/Dockerfile.arm64
platforms: linux/arm64
push: true
tags: |
cometbft/cometbft-db-testing:latest
cometbft/cometbft-db-testing:${{ github.event.inputs.refName }}
8 changes: 3 additions & 5 deletions tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,24 @@
# PLEASE BUMP THE VERSION OF THE IMAGE IN `.github/workflows/ci.yml` WHEN YOU
# MODIFY THIS FILE.

FROM golang:1.23.5 AS build
FROM golang:1.23.5

ENV LD_LIBRARY_PATH=/usr/local/lib

RUN apt update \
&& apt install -y \
libbz2-dev libgflags-dev libsnappy-dev libzstd-dev zlib1g-dev liblz4-dev \
make tar wget build-essential \
make tar wget build-essential g++ cmake \
libleveldb-dev libleveldb1d

FROM build AS install
ARG ROCKSDB=9.8.4

# Install Rocksdb
# Install RocksDB
RUN \
wget -q https://github.com/facebook/rocksdb/archive/refs/tags/v${ROCKSDB}.tar.gz \
&& tar -zxf v${ROCKSDB}.tar.gz \
&& cd rocksdb-${ROCKSDB} \
&& DEBUG_LEVEL=0 make -j4 shared_lib \
&& make install-shared \
&& ldconfig \
&& cd .. \
&& rm -rf v${ROCKSDB}.tar.gz rocksdb-${ROCKSDB}
15 changes: 15 additions & 0 deletions tools/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file defines the container image used to build and test tm-db in CI.
# The CI workflows use the latest tag of cometbft/cometbft-db-testing built
# from these settings.
#
# The jobs defined in the Build & Push workflow will build and update the image
# when changes to this file are merged. If you have other changes that require
# updates here, merge the changes here first and let the image get updated (or
# push a new version manually) before PRs that depend on them.

# PLEASE BUMP THE VERSION OF THE IMAGE IN `.github/workflows/ci.yml` WHEN YOU
# MODIFY THIS FILE.

FROM golang:1.23.5

RUN apt update && apt install -y libleveldb-dev libleveldb1d

0 comments on commit f9acb55

Please sign in to comment.