From dee7a0d71184ba2278b0385c5f904bd0cf6f870e Mon Sep 17 00:00:00 2001 From: tiero <3596602+tiero@users.noreply.github.com> Date: Fri, 10 Dec 2021 16:11:29 +0100 Subject: [PATCH] build image for arm64 arch --- .github/workflows/docker-publish.yml | 40 +++++++++---------- 0.21.0/Dockerfile | 60 ++++++++++++++++++++++------ 2 files changed, 66 insertions(+), 34 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0ef007b..745b9dd 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -17,36 +17,32 @@ jobs: push: runs-on: ubuntu-latest if: github.event_name == 'push' - - permissions: - contents: read - packages: write + env: + DOCKER_CLI_EXPERIMENTAL: "enabled" steps: - uses: actions/checkout@v2 - - - name: Build image - run: docker build . --file ./$VERSION/Dockerfile --tag $IMAGE_NAME + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + install: true - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Push image - run: | - IMAGE_ID=ghcr.io/vulpemventures/$IMAGE_NAME - - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker tag $IMAGE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - - docker tag $IMAGE_NAME $IMAGE_ID:latest - docker push $IMAGE_ID:latest + - name: Build image + run: >- + docker buildx build --push + --file ./$VERSION/Dockerfile + --tag ghcr.io/vulpemventures/$IMAGE_NAME:latest + --tag ghcr.io/vulpemventures/$IMAGE_NAME:$VERSION + --platform linux/arm64,linux/amd64 . diff --git a/0.21.0/Dockerfile b/0.21.0/Dockerfile index f849267..2cd907c 100644 --- a/0.21.0/Dockerfile +++ b/0.21.0/Dockerfile @@ -1,28 +1,62 @@ -FROM debian:stable-slim AS builder +FROM debian:stable-slim as builder -# VERSION of Elements Core to be build +# VERSION of BItcoin Core to be build ARG VERSION=0.21.0 -RUN apt-get update && apt-get install -y wget curl libzmq3-dev build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb-dev libdb++-dev libdb4.8 +RUN apt-get update && apt-get install -y \ + build-essential \ + automake pkg-config \ + wget curl libzmq3-dev \ + libtool autotools-dev \ + bsdmainutils python3 \ + libsqlite3-dev libdb-dev \ + libdb++-dev libevent-dev \ + libboost-dev libboost-system-dev \ + libboost-filesystem-dev libboost-test-dev -RUN wget -qO- https://github.com/ElementsProject/elements/archive/elements-$VERSION.tar.gz | tar -xvz -C /tmp +RUN wget -qO- https://github.com/ElementsProject/elements/archive/elements-$VERSION.tar.gz | tar -xvz -RUN cd /tmp/elements-elements-$VERSION/depends && make NO_QT=1 NO_UPNP=1 && cd .. && \ - ./autogen.sh && \ - ./configure --without-gui --with-incompatible-bdb && \ - make && \ - mv ./src/elementsd /elementsd && \ +WORKDIR /elements-elements-$VERSION + +RUN cd ./depends && make NO_QT=1 NO_UPNP=1 && cd .. && ./autogen.sh + +RUN ./configure \ + LDFLAGS=-static-libstdc++ \ + CXXFLAGS="-O2" \ + --disable-man \ + --disable-shared \ + --disable-ccache \ + --disable-tests \ + --enable-static \ + --without-gui \ + --without-libs \ + --with-utils \ + --with-zmq \ + --with-sqlite=yes \ + --without-miniupnpc \ + --enable-reduce-exports \ + --with-incompatible-bdb \ + --enable-glibc-back-compat + +RUN make clean +RUN make -j$(( $(nproc) + 1 )) check +RUN make install + +RUN mv ./src/elementsd /elementsd && \ mv ./src/elements-cli /elements-cli FROM debian:stable-slim -RUN apt-get update && apt-get install -y libboost-filesystem-dev \ +RUN apt-get update && apt-get install -y \ + libboost-system-dev \ + libboost-filesystem-dev \ libboost-thread-dev \ libevent-dev \ libsodium-dev \ - libzmq3-dev \ libdb-dev \ - libdb++-dev + libdb++-dev \ + libzmq3-dev \ + libsqlite3-dev RUN useradd -ms /bin/bash elements @@ -35,3 +69,5 @@ COPY --from=builder /elements-cli /usr/local/bin/elements-cli RUN mkdir -p "$HOME/.elements/" ENTRYPOINT [ "elementsd" ] + +