Skip to content

Commit e0aa407

Browse files
committed
build image for arm64 arch
1 parent e4f5067 commit e0aa407

File tree

2 files changed

+37
-48
lines changed

2 files changed

+37
-48
lines changed

.github/workflows/docker-publish.yml

+18-22
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,32 @@ jobs:
1717
push:
1818
runs-on: ubuntu-latest
1919
if: github.event_name == 'push'
20-
21-
permissions:
22-
contents: read
23-
packages: write
20+
env:
21+
DOCKER_CLI_EXPERIMENTAL: "enabled"
2422

2523
steps:
2624
- uses: actions/checkout@v2
27-
28-
- name: Build image
29-
run: docker build . --file ./$VERSION/Dockerfile --tag $IMAGE_NAME
3025

26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v1
28+
29+
- name: Set up Docker Buildx
30+
id: buildx
31+
uses: docker/setup-buildx-action@v1
32+
with:
33+
install: true
3134

3235
- name: Login to GitHub Container Registry
3336
uses: docker/login-action@v1
3437
with:
3538
registry: ghcr.io
36-
username: ${{ github.actor }}
39+
username: ${{ github.repository_owner }}
3740
password: ${{ secrets.GITHUB_TOKEN }}
3841

39-
- name: Push image
40-
run: |
41-
IMAGE_ID=ghcr.io/vulpemventures/$IMAGE_NAME
42-
43-
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
44-
45-
echo IMAGE_ID=$IMAGE_ID
46-
echo VERSION=$VERSION
47-
48-
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
49-
docker push $IMAGE_ID:$VERSION
50-
51-
docker tag $IMAGE_NAME $IMAGE_ID:latest
52-
docker push $IMAGE_ID:latest
42+
- name: Build image
43+
run: >-
44+
docker buildx build --push
45+
--file ./$VERSION/Dockerfile
46+
--tag ghcr.io/vulpemventures/$IMAGE_NAME:latest
47+
--tag ghcr.io/vulpemventures/$IMAGE_NAME:$VERSION
48+
--platform linux/arm64,linux/amd64 .

0.21.0/Dockerfile

+19-26
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
1-
FROM debian:stable-slim AS builder
1+
FROM debian:stretch-slim as builder
22

3-
# VERSION of Elements Core to be build
3+
# VERSION of Elements Core to be download
44
ARG VERSION=0.21.0
5+
ARG TARGETPLATFORM
56

6-
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
7+
RUN set -ex \
8+
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=x86_64-linux-gnu; fi \
9+
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=aarch64-linux-gnu; fi \
10+
&& apt-get update \
11+
&& apt-get install -qq --no-install-recommends ca-certificates wget \
12+
&& cd /tmp \
13+
&& wget -qO elements.tar.gz "https://github.com/ElementsProject/elements/releases/download/elements-$VERSION/elements-elements-$VERSION-$TARGETPLATFORM.tar.gz" \
14+
&& mkdir bin \
15+
&& tar -xzvf elements.tar.gz -C /tmp/bin --strip-components=2 "elements-elements-$VERSION/bin/elements-cli" "elements-elements-$VERSION/bin/elementsd"
716

8-
RUN wget -qO- https://github.com/ElementsProject/elements/archive/elements-$VERSION.tar.gz | tar -xvz -C /tmp
17+
FROM debian:stretch-slim
918

10-
RUN cd /tmp/elements-elements-$VERSION/depends && make NO_QT=1 NO_UPNP=1 && cd .. && \
11-
./autogen.sh && \
12-
./configure --without-gui --with-incompatible-bdb && \
13-
make && \
14-
mv ./src/elementsd /elementsd && \
15-
mv ./src/elements-cli /elements-cli
19+
COPY --from=builder "/tmp/bin" /usr/local/bin
1620

17-
FROM debian:stable-slim
18-
19-
RUN apt-get update && apt-get install -y libboost-filesystem-dev \
20-
libboost-thread-dev \
21-
libevent-dev \
22-
libsodium-dev \
23-
libzmq3-dev \
24-
libdb-dev \
25-
libdb++-dev
26-
27-
RUN useradd -ms /bin/bash elements
21+
RUN groupadd -r elements && useradd -r -m -g elements elements
2822

2923
USER elements
3024

31-
COPY --from=builder /elementsd /usr/local/bin/elementsd
32-
COPY --from=builder /elements-cli /usr/local/bin/elements-cli
33-
34-
# Prevents `VOLUME $HOME/.elements/` being created as owned by `root`
35-
RUN mkdir -p "$HOME/.elements/"
25+
RUN mkdir -p "$HOME/.elements/" \
26+
&& chown -R elements:elements /home/elements/.elements
3627

3728
ENTRYPOINT [ "elementsd" ]
29+
30+

0 commit comments

Comments
 (0)