Skip to content

Commit

Permalink
Removing cache & platforms for base testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahanaFarooqui committed Jun 13, 2024
1 parent 7573e21 commit befff4b
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 85 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,11 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/arm/v7
tags: |
shahanafarooqui/lightningd:${{ github.event.inputs.version }}
shahanafarooqui/lightningd:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
elementsproject/lightningd:${{ github.event.inputs.version }}
153 changes: 81 additions & 72 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,80 +184,89 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RU
RUN rustup toolchain install stable --component rustfmt --allow-downgrade

COPY --from=downloader /usr/bin/${target_host_qemu} /usr/bin/${target_host_qemu}
WORKDIR /opt/lightningd

# # Build the configurator binary for each architecture
# # Fix `configurator: Exec format error` on ARM and ARM64
# WORKDIR /opt/lightningd/ccan/tools/configurator
# COPY ccan/tools/configurator/configurator.c configurator.c
# RUN $CC -o configurator configurator.c
# WORKDIR /opt/lightningd

# If cross-compiling, need to tell it to cargo.
RUN ( ! [ -n "${target_host}" ] ) || \
(mkdir -p .cargo && echo "[target.${target_host_rust}]\nlinker = \"${target_host}-gcc\"" > .cargo/config)

# Weird errors with cargo for cln-grpc on arm7 https://github.com/ElementsProject/lightning/issues/6596
RUN ( ! [ "${target_host}" = "arm-linux-gnueabihf" ] ) || \
(sed -i '/documentation = "https:\/\/docs.rs\/cln-grpc"/a include = ["**\/*.*"]' cln-grpc/Cargo.toml)

RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
make && \
/root/.local/bin/poetry run make install

# We need to build python plugins on the target's arch because python doesn't support cross build
FROM ${BASE_DISTRO} as builder-python
RUN apt-get update -qq && \
apt-get install -qq -y --no-install-recommends \
git \
curl \
libtool \
pkg-config \
autoconf \
automake \
build-essential \
libffi-dev \
libssl-dev \
python3.9 \
python3-dev \
python3-pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
ENV PATH=$PATH:/root/.cargo/bin/
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN rustup toolchain install stable --component rustfmt --allow-downgrade

WORKDIR /opt/lightningd
COPY plugins/clnrest/requirements.txt plugins/clnrest/requirements.txt
COPY plugins/wss-proxy/requirements.txt plugins/wss-proxy/requirements.txt
ENV PYTHON_VERSION=3
RUN pip3 install -r plugins/clnrest/requirements.txt && \
pip3 install -r plugins/wss-proxy/requirements.txt && \
pip3 cache purge

FROM ${BASE_DISTRO} as final

RUN apt-get update && \
apt-get install -y --no-install-recommends \
tini \
socat \
inotify-tools \
jq \
python3.9 \
python3-pip \
libpq5 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV LIGHTNINGD_DATA=/root/.lightning
ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735
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-python /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 tools/docker-entrypoint.sh entrypoint.sh

EXPOSE 9735 9835
ENTRYPOINT [ "/usr/bin/tini", "-g", "--", "./entrypoint.sh" ]
# # Weird errors with cargo for cln-grpc on arm7 https://github.com/ElementsProject/lightning/issues/6596
# RUN ( ! [ "${target_host}" = "arm-linux-gnueabihf" ] ) || \
# (sed -i '/documentation = "https:\/\/docs.rs\/cln-grpc"/a include = ["**\/*.*"]' cln-grpc/Cargo.toml)

RUN apt-get update && apt-get install -y bash
ENTRYPOINT ["/bin/bash"]

# RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
# make && \
# /root/.local/bin/poetry run make install

# # We need to build python plugins on the target's arch because python doesn't support cross build
# FROM ${BASE_DISTRO} as builder-python
# RUN apt-get update -qq && \
# apt-get install -qq -y --no-install-recommends \
# git \
# curl \
# libtool \
# pkg-config \
# autoconf \
# automake \
# build-essential \
# libffi-dev \
# libssl-dev \
# python3.9 \
# python3-dev \
# python3-pip && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/*

# RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
# ENV PATH=$PATH:/root/.cargo/bin/
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# RUN rustup toolchain install stable --component rustfmt --allow-downgrade

# WORKDIR /opt/lightningd
# COPY plugins/clnrest/requirements.txt plugins/clnrest/requirements.txt
# COPY plugins/wss-proxy/requirements.txt plugins/wss-proxy/requirements.txt
# ENV PYTHON_VERSION=3
# RUN pip3 install -r plugins/clnrest/requirements.txt && \
# pip3 install -r plugins/wss-proxy/requirements.txt && \
# pip3 cache purge

# FROM ${BASE_DISTRO} as final

# RUN apt-get update && \
# apt-get install -y --no-install-recommends \
# tini \
# socat \
# inotify-tools \
# jq \
# python3.9 \
# python3-pip \
# libpq5 && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/*

# ENV LIGHTNINGD_DATA=/root/.lightning
# ENV LIGHTNINGD_RPC_PORT=9835
# ENV LIGHTNINGD_PORT=9735
# 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-python /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 tools/docker-entrypoint.sh entrypoint.sh

# EXPOSE 9735 9835
# ENTRYPOINT [ "/usr/bin/tini", "-g", "--", "./entrypoint.sh" ]

0 comments on commit befff4b

Please sign in to comment.