diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2204bda..4dfd462 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,15 +8,18 @@ on: jobs: docker: + strategy: + matrix: + test: ["eth_getBalance", "eth_getBlockByNumber"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: docker/setup-buildx-action@v2 - run: docker build --tag paradigmxyz/flood:latest . - run: docker run --rm paradigmxyz/flood:latest version - - run: | + - name: ${{ matrix.test }} + run: | docker run --rm paradigmxyz/flood:latest \ - eth_getBlockByNumber \ + ${{ matrix.test }} \ node1=https://eth.llamarpc.com \ - node2=https://eth.llamarpc.com \ --duration 3 --rate 1 diff --git a/Dockerfile b/Dockerfile index bc88ba4..12f21de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # https://github.com/paradigmxyz/flood/pkgs/container/flood # Stage 1: Install flood -FROM python:3.11.3-slim AS flood-builder +FROM python:3.11-slim AS flood-builder ENV USERNAME="flood" ENV PATH="${PATH}:/home/${USERNAME}/.local/bin" RUN adduser $USERNAME @@ -14,23 +14,26 @@ RUN pip install --user --no-cache-dir ./ # Stage 2: Install vegeta FROM debian:stable-slim AS vegeta-builder +ENV VEGETA_VERSION=12.8.4 RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates \ && rm -rf /var/lib/apt/lists/* \ && mkdir /vegeta WORKDIR /vegeta -RUN wget https://github.com/tsenart/vegeta/releases/download/v12.8.4/vegeta_12.8.4_linux_amd64.tar.gz \ - && tar xzf vegeta_12.8.4_linux_amd64.tar.gz \ - && rm vegeta_12.8.4_linux_amd64.tar.gz +RUN wget https://github.com/tsenart/vegeta/releases/download/v${VEGETA_VERSION}/vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz \ + && tar xzf vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz \ + && rm vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz # Final stage: Combine flood and vegeta -FROM python:3.11.3-slim +FROM python:3.11-slim ENV USERNAME="flood" ENV PATH="${PATH}:/home/${USERNAME}/.local/bin" RUN adduser $USERNAME -USER $USERNAME +RUN apt-get update && apt-get install -y --no-install-recommends curl \ + && rm -rf /var/lib/apt/lists/* COPY --from=flood-builder /home/$USERNAME/.local /home/$USERNAME/.local COPY --from=vegeta-builder /vegeta/vegeta /home/$USERNAME/.local/bin/vegeta +USER $USERNAME WORKDIR /home/$USERNAME ENTRYPOINT ["python", "-m", "flood"]