docker: Dockerfile aarch images with pyln and clnrest

Changelog-None
This commit is contained in:
Shahana Farooqui 2023-07-31 06:40:46 -07:00 committed by Rusty Russell
parent 59a0ed41ff
commit 0a99f0e9cd
2 changed files with 51 additions and 25 deletions

View file

@ -8,8 +8,8 @@
FROM debian:bullseye-slim as downloader
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr qemu-user-static wget
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel /tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel.asc /tini.asc
@ -52,22 +52,27 @@ RUN apt-get update -qq && \
ca-certificates \
curl \
dirmngr \
gcc-10 \
gettext \
git \
gnupg \
libpq-dev \
libtool \
libffi-dev \
pkg-config \
libssl-dev \
protobuf-compiler \
python3 \
python3.9 \
python3-dev \
python3-mako \
python3-pip \
python3-venv \
python3-setuptools \
libev-dev \
libevent-dev \
qemu-user-static \
wget
RUN apt-get update && apt-get install -y pkg-config libssl-dev
ENV PKG_CONFIG_PATH /usr/lib/arm-linux-gnueabihf/pkgconfig
RUN wget -q https://zlib.net/fossils/zlib-1.2.13.tar.gz \
@ -102,34 +107,43 @@ RUN rustup toolchain install stable --component rustfmt --allow-downgrade
WORKDIR /opt/lightningd
COPY . /tmp/lightning
RUN git clone --recursive /tmp/lightning . && \
git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
ARG DEVELOPER=1
ENV PYTHON_VERSION=3
RUN curl -sSL https://install.python-poetry.org | python3 -
RUN pip3 install -U pip
RUN pip3 install -U wheel
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 wheel cryptography
RUN pip3 install grpcio-tools
RUN /root/.local/bin/poetry install
RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
make DEVELOPER=${DEVELOPER} && \
/root/.local/bin/poetry run make install
# RUN pip3 install -r plugins/clnrest/requirements.txt
RUN pip3 install flask gunicorn json5 flask_restx flask-socketio gevent gevent-websocket
RUN pip3 install ./contrib/pyln-client
FROM debian:bullseye-slim as final
RUN apt-get update && \
apt-get install -y --no-install-recommends \
socat \
inotify-tools \
python3 \
python3.9 \
python3-pip \
qemu-user-static \
libpq5 && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install flask gunicorn json5
RUN pip3 install --user flask_restx pyln-client
ENV LIGHTNINGD_DATA=/root/.lightning
ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735
@ -138,7 +152,9 @@ ENV LIGHTNINGD_NETWORK=bitcoin
RUN mkdir $LIGHTNINGD_DATA && \
touch $LIGHTNINGD_DATA/config
VOLUME [ "/root/.lightning" ]
COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=builder /usr/local/lib/python3.9/dist-packages/ /usr/local/lib/python3.9/dist-packages/
COPY --from=downloader /opt/bitcoin/bin /usr/bin
COPY --from=downloader /opt/litecoin/bin /usr/bin
COPY --from=downloader "/tini" /usr/bin/tini

View file

@ -9,17 +9,13 @@ FROM debian:bullseye-slim as downloader
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr qemu-user-static wget
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-arm64 /tini
RUN chmod +x /tini
WORKDIR /opt
RUN wget -qO /opt/tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \
&& echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /opt/tini" | sha256sum -c - \
&& chmod +x /opt/tini
ARG BITCOIN_VERSION=22.0
ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL
@ -57,22 +53,27 @@ RUN apt-get update -qq && \
ca-certificates \
curl \
dirmngr \
gcc-10 \
gettext \
git \
gnupg \
libpq-dev \
libtool \
libffi-dev \
pkg-config \
libssl-dev \
protobuf-compiler \
python3 \
python3.9 \
python3-dev \
python3-mako \
python3-pip \
python3-venv \
python3-setuptools \
libev-dev \
libevent-dev \
qemu-user-static \
wget
RUN apt-get update && apt-get install -y pkg-config libssl-dev
ENV PKG_CONFIG_PATH /usr/lib/arm-linux-gnueabihf/pkgconfig
RUN wget -q https://zlib.net/fossils/zlib-1.2.13.tar.gz \
@ -107,23 +108,32 @@ RUN rustup toolchain install stable --component rustfmt --allow-downgrade
WORKDIR /opt/lightningd
COPY . /tmp/lightning
RUN git clone --recursive /tmp/lightning . && \
git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
ARG DEVELOPER=1
ENV PYTHON_VERSION=3
RUN curl -sSL https://install.python-poetry.org | python3 -
RUN pip3 install -U pip
RUN pip3 install -U wheel
RUN curl -sSL https://install.python-poetry.org | python3 -
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 wheel cryptography
RUN pip3 install grpcio-tools
RUN /root/.local/bin/poetry install
RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
make DEVELOPER=${DEVELOPER} && \
/root/.local/bin/poetry run make install
FROM debian:bullseye-slim as final
# RUN pip3 install -r plugins/clnrest/requirements.txt
RUN pip3 install flask gunicorn json5 flask_restx flask-socketio gevent gevent-websocket
RUN pip3 install ./contrib/pyln-client
COPY --from=downloader /opt/tini /usr/bin/tini
FROM debian:bullseye-slim as final
RUN apt-get update && \
apt-get install -y --no-install-recommends \
@ -131,12 +141,10 @@ RUN apt-get update && \
inotify-tools \
python3 \
python3-pip \
qemu-user-static \
libpq5 && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install flask gunicorn json5
RUN pip3 install --user flask_restx pyln-client
ENV LIGHTNINGD_DATA=/root/.lightning
ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735
@ -145,7 +153,9 @@ ENV LIGHTNINGD_NETWORK=bitcoin
RUN mkdir $LIGHTNINGD_DATA && \
touch $LIGHTNINGD_DATA/config
VOLUME [ "/root/.lightning" ]
COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=builder /usr/local/lib/python3/dist-packages/ /usr/local/lib/python3/dist-packages/
COPY --from=downloader /opt/bitcoin/bin /usr/bin
COPY --from=downloader /opt/litecoin/bin /usr/bin
COPY --from=downloader "/tini" /usr/bin/tini