From 4cb6257123fea2d9ee9b475994b19cd8565b8885 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 14 Aug 2023 13:46:19 +0200 Subject: [PATCH] testing: Fixed Dockerfile due to rebase --- .github/workflows/check-self.yml | 6 ++---- Makefile | 2 +- libs/gl-testing/Dockerfile | 25 ++++++++++--------------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check-self.yml b/.github/workflows/check-self.yml index 2c1566a44..053e33f6b 100644 --- a/.github/workflows/check-self.yml +++ b/.github/workflows/check-self.yml @@ -18,7 +18,5 @@ jobs: - name: Build tester image run: | - docker build -t gltesting:latest -f libs/gl-testing/Dockerfile . - - - name: Check Self - run: make docker-check-self + sudo chmod a+rwx -R libs/gl-client-py + make docker-image docker-check-self diff --git a/Makefile b/Makefile index 538d39797..d67fed5e2 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ ensure-docker: echo "We are not running in the gl-testing docker container, refusing to run"; \ exit 1; \ fi - + docker-image: ${REPO_ROOT}/libs/gl-testing/Dockerfile docker buildx build \ --load \ diff --git a/libs/gl-testing/Dockerfile b/libs/gl-testing/Dockerfile index d57bf1a66..690a89f15 100644 --- a/libs/gl-testing/Dockerfile +++ b/libs/gl-testing/Dockerfile @@ -120,12 +120,16 @@ ENV PATH=/opt/cln-latest/usr/local/bin/:$PATH # And we also add the cargo bin directory just for the sake of # simplifying a dev's life. -ENV PATH=/root/.cargo/bin:$PATH +ENV PATH=/home/$DOCKER_USER/.cargo/bin:$PATH # Make sure we can tell when running in the docker container. This is # helpful if we expect to be run in the container, but have been # invoked somewhere else. ENV GL_DOCKER=1 +ENV PATH=/tmp/venv/bin:$PATH +ENV VIRTUAL_ENV=/tmp/venv +ENV NPM_PACKAGES="${HOME}/.npm-packages" +ENV PATH="${PATH}:${NPM_PACKAGES}/bin" RUN cd /tmp/ && \ wget https://storage.googleapis.com/c-lightning-tests/bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.bz2 -O bitcoin.tar.bz2 && \ @@ -149,8 +153,10 @@ RUN wget -q https://github.com/cloudflare/cfssl/releases/download/v1.5.0/cfssl_1 RUN wget -q https://github.com/cloudflare/cfssl/releases/download/v1.5.0/cfssljson_1.5.0_linux_amd64 -O /usr/bin/cfssljson && \ chmod a+x /usr/bin/cfssljson -# Copy from builder -COPY --from=builder /repo/libs/target/wheels/gl_client* /opt/ +COPY --from=builder /repo/cln-versions/ /opt/cln +COPY --from=builder /tmp/target /tmp/target +ADD . /repo +RUN chown $DOCKER_USER -R /tmp/target /repo # Switch to docker user bevore we install dependencies. USER $DOCKER_USER @@ -167,8 +173,6 @@ RUN curl \ # Run in a venv, so we don't get warnings about root being special. RUN python3 -m venv /tmp/venv -ENV PATH=/tmp/venv/bin:$PATH -ENV VIRTUAL_ENV=/tmp/venv RUN python3 -m pip install -U pip tomli && \ python3 -m pip install \ @@ -183,26 +187,17 @@ RUN python3 -m pip install -U pip tomli && \ pytest-cov \ grpcio \ pytest-xdist \ - maturin \ - /opt/gl_client* + maturin[patchelf] RUN git config --global --add safe.directory /repo # Install nodejs RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash RUN mkdir "${HOME}/.npm-packages" && npm config set prefix "${HOME}/.npm-packages" -ENV NPM_PACKAGES="${HOME}/.npm-packages" -ENV PATH="${PATH}:${NPM_PACKAGES}/bin" # Required to build and test the JS bindings RUN npm install -g cargo-cp-artifact -COPY --from=builder /repo/cln-versions/ /opt/cln -RUN ln -s /opt/cln/v23.05gl1 /opt/cln-latest - -USER $DOCKER_USER -COPY --from=builder /tmp/target /tmp/target -ADD . /repo RUN (cd /repo/libs/gl-client-py; maturin develop) # Install `gl-testing`. When integrators use this image they'll mount # their own code into `/repo`