Skip to content

Commit

Permalink
fix: dockerfiles (#318)
Browse files Browse the repository at this point in the history
* fix: python3 installation

* fix: install `python3`

* fix: also install python3 here

* test: pipx

* fix: build polycli with version flags

* fix: polycli build dir

* fix: revert build change since it's not supported :(

* chore: bump toolbox version

* chore: use pipx in zkevm-contracts also

* chore: nit

* docs: nit
  • Loading branch information
leovct authored Oct 18, 2024
1 parent 446b012 commit ba2d95c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ This image contains all the npm dependencies and zkevm contracts compiled for a
Build the `zkevm-contracts` image.

```bash
version="v9.0.0-rc.2-pp"
version="v9.0.0-rc.2-pp-fork.12"
docker build . \
--tag local/zkevm-contracts:$version \
--build-arg ZKEVM_CONTRACTS_BRANCH=$version \
Expand All @@ -96,8 +96,8 @@ Check the size of the image.

```bash
$ docker images --filter "reference=local/zkevm-contracts"
REPOSITORY TAG IMAGE ID CREATED SIZE
local/zkevm-contracts v9.0.0-rc.2-pp bdf8225cfa77 7 minutes ago 2.54GB
REPOSITORY TAG IMAGE ID CREATED SIZE
local/zkevm-contracts v9.0.0-rc.2-pp-fork.12 bdf8225cfa77 7 minutes ago 2.54GB
```

(Optional) Push image to the Docker Hub.
Expand Down
9 changes: 5 additions & 4 deletions docker/toolbox.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@ FROM golang:1.21 AS polycli-builder
ARG POLYCLI_VERSION
WORKDIR /opt/polygon-cli
RUN git clone --branch ${POLYCLI_VERSION} https://github.com/maticnetwork/polygon-cli.git . \
&& go build -o polycli main.go
&& make build


FROM ubuntu:24.04
LABEL author="[email protected]"
LABEL description="Blockchain toolbox"

COPY --from=polycli-builder /opt/polygon-cli/polycli /usr/bin/polycli
COPY --from=polycli-builder /opt/polygon-cli/out/polycli /usr/bin/polycli
COPY --from=polycli-builder /opt/polygon-cli/bindings /opt/bindings
# WARNING (DL3008): Pin versions in apt get install.
# WARNING (DL3013): Pin versions in pip.
# WARNING (DL4006): Set the SHELL option -o pipefail before RUN with a pipe in it
# WARNING (SC1091): (Sourced) file not included in mock.
# hadolint ignore=DL3008,DL3013,DL4006,SC1091
RUN apt-get update \
&& apt-get install --no-install-recommends --yes curl git jq python3-pip \
&& apt-get install --yes --no-install-recommends curl git jq pipx \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir yq \
&& pipx ensurepath \
&& pipx install yq \
&& curl --silent --location --proto "=https" https://foundry.paradigm.xyz | bash \
&& /root/.foundry/bin/foundryup \
&& cp /root/.foundry/bin/* /usr/local/bin
9 changes: 5 additions & 4 deletions docker/zkevm-contracts.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.21 AS polycli-builder
ARG POLYCLI_VERSION
WORKDIR /opt/polygon-cli
RUN git clone --branch ${POLYCLI_VERSION} https://github.com/maticnetwork/polygon-cli.git . \
&& go build -o polycli main.go
&& make build


FROM node:22-bookworm
Expand All @@ -19,17 +19,18 @@ RUN git clone https://github.com/0xPolygonHermez/zkevm-contracts . \
&& npx hardhat compile

# STEP 2: Install tools.
COPY --from=polycli-builder /opt/polygon-cli/polycli /usr/bin/polycli
COPY --from=polycli-builder /opt/polygon-cli/out/polycli /usr/bin/polycli
WORKDIR /opt
# WARNING (DL3008): Pin versions in apt get install.
# WARNING (DL3013): Pin versions in pip.
# WARNING (DL4006): Set the SHELL option -o pipefail before RUN with a pipe in it
# hadolint ignore=DL3008,DL3013,DL4006
RUN apt-get update \
&& apt-get install --no-install-recommends --yes jq python3-pip \
&& apt-get install --yes --no-install-recommends curl git jq pipx \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --break-system-packages --no-cache-dir yq \
&& pipx ensurepath \
&& pipx install yq \
&& curl --silent --location --proto "=https" https://foundry.paradigm.xyz | bash \
&& /root/.foundry/bin/foundryup \
&& cp /root/.foundry/bin/* /usr/local/bin
Expand Down
4 changes: 2 additions & 2 deletions docs/trigger-a-reorg/network-helper.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM golang:1.21 AS polycli-builder
WORKDIR /opt/polygon-cli
RUN git clone https://github.com/maticnetwork/polygon-cli.git . \
&& CGO_ENABLED=0 go build -o polycli main.go
&& make build

FROM nicolaka/netshoot:v0.12
LABEL author="[email protected]"
LABEL description="Helper image to debug network issues"
COPY --from=polycli-builder /opt/polygon-cli/polycli /usr/local/bin/polycli
COPY --from=polycli-builder /opt/polygon-cli/out/polycli /usr/local/bin/polycli
2 changes: 1 addition & 1 deletion src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ SEQUENCER_NAME = struct(
ZKEVM="zkevm-node-sequencer",
)

TX_SPAMMER_IMG = "leovct/toolbox:0.0.4"
TX_SPAMMER_IMG = "leovct/toolbox:0.0.5"

0 comments on commit ba2d95c

Please sign in to comment.