diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..865b3f50 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +# This Docker ignore file aims to optimise the build process of the interop tests. +# The Dockerfile in ./interop-tests/Dockerfile copies a locally built binary into the container and +# thus does not need anything else to be present in the working directory. +* + +# CI will build and copy over the release binary. +!target/release/ping + +# Locally, we might want to build it as `debug` binary to accelerate the build process. +!target/debug/ping diff --git a/.github/workflows/interop-test.yml b/.github/workflows/interop-test.yml index bd438019..9351198b 100644 --- a/.github/workflows/interop-test.yml +++ b/.github/workflows/interop-test.yml @@ -24,13 +24,10 @@ jobs: - name: Install Protoc run: sudo apt-get install protobuf-compiler - name: Build image - working-directory: ./interop-tests run: | cargo build --release -p interop-tests - mkdir -p target/release/ - cp ../target/release/ping target/release - docker build -t rust-libp2p-head . - docker image save -o ping-image.tar rust-libp2p-head + docker build -t rust-libp2p-head --build-arg=TEST_BINARY=target/release/ping . -f ./interop-tests/Dockerfile + docker image save -o ./interop-tests/ping-image.tar rust-libp2p-head - name: Upload ping versions info uses: actions/upload-artifact@v3 with: diff --git a/interop-tests/Dockerfile b/interop-tests/Dockerfile index 0f28bb61..7197b378 100644 --- a/interop-tests/Dockerfile +++ b/interop-tests/Dockerfile @@ -1,4 +1,5 @@ FROM ubuntu:22.04 -COPY target/release/ping /usr/local/bin/testplan +ARG TEST_BINARY +COPY $TEST_BINARY /usr/local/bin/testplan ENV RUST_BACKTRACE=1 ENTRYPOINT ["testplan"]