From 0ab5ff1ae66a61c7b9019e1c7b6494a3f43fbab2 Mon Sep 17 00:00:00 2001 From: Erik De Smedt Date: Wed, 10 Apr 2024 14:31:25 +0200 Subject: [PATCH] Dockerfile for integration testing --- .dockerignore | 3 ++ .github/workflows/test-integration.yml | 13 ++++++ docker/Dockerfile | 63 ++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/test-integration.yml create mode 100644 docker/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ee8974b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +docker +tests +.github \ No newline at end of file diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml new file mode 100644 index 0000000..b7769bd --- /dev/null +++ b/.github/workflows/test-integration.yml @@ -0,0 +1,13 @@ +name: integration-tests +run-name: python - Integration Tests +on: [push] +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: docker-build + run: docker build -f docker/Dockerfile -t lsp-testing . + - name: docker-test + run: docker run lsp-testing python -m pytest diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..2256f55 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,63 @@ +# Use a base image with necessary dependencies for compiling +FROM ubuntu:latest as cln-downloader + +RUN apt-get update && apt-get install -y curl +RUN curl -Lo lightning.tar.xz https://github.com/ElementsProject/lightning/releases/download/v24.02.2/clightning-v24.02.2-Ubuntu-20.04.tar.xz + +FROM ubuntu:latest as bitcoin-downloader +RUN apt-get update && apt-get install -y curl +RUN curl -Lo bitcoin.tar.gz https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz + +FROM ubuntu:latest as rust-downloader +RUN apt-get update && apt-get install -y curl +RUN curl -Lo rustup.sh https://sh.rustup.rs + +FROM rust:latest as plugin-compiler +ADD . /workspace +WORKDIR workspace + +RUN cargo build --workspace + +FROM ubuntu:latest as python-downloader + +RUN apt-get update && apt-get install -y python3 python3-venv python-pip + +ENV VENV_PATH=/opt/python/venv +RUN python3 -m venv $VENV_PATH +ENV PATH=$VENV_PATH/bin:$PATH +ADD requirements.txt requirements.txt +RUN pip install -r requirements.txt + +FROM ubuntu:latest as runner +RUN apt-get update && apt-get install -y libsodium-dev sqlite3 libpq5 libsqlite3-dev xz-utils python3 curl build-essential python3-pip pkg-config libssl-dev + +copy --from=rust-downloader rustup.sh /tmp/rustup.sh +ENV CARGO_HOME=/opt/cargo +ENV PATH=$CARGO_HOME/bin:$PATH +RUN sh /tmp/rustup.sh -y + +RUN cargo install sqlx-cli + +COPY --from=cln-downloader lightning.tar.xz /tmp/lightning.tar.xz +COPY --from=bitcoin-downloader bitcoin.tar.gz /tmp/bitcoin.tar.gz +COPY --from=python-downloader /opt/python/venv /opt/python/venv + +ENV PATH=/opt/python/venv/bin:$PATH +RUN tar -xf /tmp/bitcoin.tar.gz && mv /bitcoin-25.0/bin/* /usr/bin/ +RUN tar -xf /tmp/lightning.tar.xz + +ADD . /workspace +WORKDIR /workspace + +RUN make all + + + + + + + + + + +