From befff4b909e1226eb3f8b7c9d7c5f4b2cffd22d2 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Wed, 12 Jun 2024 12:31:56 -0700 Subject: [PATCH] Removing cache & platforms for base testing --- .github/workflows/docker-release.yml | 15 +-- Dockerfile | 153 ++++++++++++++------------- 2 files changed, 83 insertions(+), 85 deletions(-) diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 62e36e787593..cc54e78223bc 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -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 }} diff --git a/Dockerfile b/Dockerfile index f99f24396331..d8bb53790de4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ]