From dd5b21ca061630fa5124be8d3da4c2165f800ac6 Mon Sep 17 00:00:00 2001 From: Evan Gray Date: Thu, 12 Dec 2024 14:55:28 -0500 Subject: [PATCH] tilt: narrow contexts and set only for ones with root --- Tiltfile | 60 +++++++------------ .../relayer-engine-v2/Dockerfile | 8 +-- sui/Dockerfile | 12 ++-- sui/Makefile | 2 +- third_party/redis/Dockerfile | 5 +- wormchain/ibc-relayer/Dockerfile | 4 +- 6 files changed, 35 insertions(+), 56 deletions(-) diff --git a/Tiltfile b/Tiltfile index 1fbc48b29b..4ba2f5e5d8 100644 --- a/Tiltfile +++ b/Tiltfile @@ -144,7 +144,8 @@ docker_build( context = ".", dockerfile = "node/Dockerfile", target = "build", - ignore=["./sdk/js", "./relayer"] + ignore = ["sdk/js", "sdk/js-*", "sdk/rust"], + only = ["node", "wormchain", "sdk"] ) def command_with_dlv(argv): @@ -514,26 +515,14 @@ docker_build( context = ".", only = ["./ethereum", "./relayer/ethereum"], dockerfile = "./ethereum/Dockerfile", - - # ignore local node_modules (in case they're present) ignore = ["./ethereum/node_modules","./relayer/ethereum/node_modules"], build_args = {"num_guardians": str(num_guardians), "dev": str(not ci)}, - - # sync external scripts for incremental development - # (everything else needs to be restarted from scratch for determinism) - # - # This relies on --update-mode=exec to work properly with a non-root user. - # https://github.com/tilt-dev/tilt/issues/3708 - live_update = [ - sync("./ethereum/src", "/home/node/app/src"), - ], ) if redis or generic_relayer: docker_build( ref = "redis", - context = ".", - only = ["./third_party"], + context = "third_party/redis", dockerfile = "third_party/redis/Dockerfile", ) @@ -575,8 +564,9 @@ if generic_relayer: ) docker_build( ref = "relayer-engine", - context = ".", - only = ["./relayer/generic_relayer", "./relayer/ethereum/ts-scripts/relayer/config"], + context = "relayer", + only = ["generic_relayer", "ethereum/ts-scripts/relayer/config"], + ignore = ["generic_relayer/node_modules"], dockerfile = "relayer/generic_relayer/relayer-engine-v2/Dockerfile", build_args = {"dev": str(not ci)} ) @@ -611,31 +601,22 @@ if ci_tests: ref = "sdk-test-image", context = ".", dockerfile = "testing/Dockerfile.sdk.test", - only = [], - live_update = [ - sync("./sdk/js/src", "/app/sdk/js/src"), - sync("./testing", "/app/testing"), - ], + only = ["ethereum", "relayer/ethereum", "solana/idl", "sdk/js", "testing"], + ignore = ["ethereum/node_modules", "relayer/ethereum/node_modules", "sdk/js/node_modules", "sdk/js/lib"], ) docker_build( ref = "spydk-test-image", context = ".", dockerfile = "testing/Dockerfile.spydk.test", - only = [], - live_update = [ - sync("./spydk/js/src", "/app/spydk/js/src"), - sync("./testing", "/app/testing"), - ], + only = ["spydk/js", "testing"], + ignore = ["spydk/js/node_modules", "spydk/js/lib"], ) docker_build( ref = "query-sdk-test-image", context = ".", dockerfile = "testing/Dockerfile.querysdk.test", - only = [], - live_update = [ - sync("./sdk/js/src", "/app/sdk/js-query/src"), - sync("./testing", "/app/testing"), - ], + only = ["sdk/js-query", "testing"], + ignore = ["sdk/js-query/node_modules", "sdk/js-query/lib"], ) k8s_yaml_with_ns( @@ -710,9 +691,10 @@ if terra2 or wormchain: docker_build( ref = "cosmwasm_artifacts", context = ".", - dockerfile = "./cosmwasm/Dockerfile", + dockerfile = "cosmwasm/Dockerfile", target = "artifacts", platform = "linux/amd64", + only = ["cosmwasm", "sdk/rust"] ) if terra2: @@ -780,10 +762,9 @@ if sui: docker_build( ref = "sui-node", target = "sui", - context = ".", + context = "sui", dockerfile = "sui/Dockerfile", - ignore = ["./sui/sui.log*", "sui/sui.log*", "sui.log.*"], - only = ["./sui"], + ignore = ["sui.log*"], ) k8s_resource( @@ -824,8 +805,8 @@ if wormchain: dockerfile = "./wormchain/Dockerfile", platform = "linux/amd64", build_args = {"num_guardians": str(num_guardians)}, - only = [], - ignore = ["./wormchain/testing", "./wormchain/ts-sdk", "./wormchain/design", "./wormchain/vue", "./wormchain/build/wormchaind"], + only = ["wormchain", "sdk"], + ignore = ["./wormchain/testing", "./wormchain/ts-sdk", "./wormchain/design", "./wormchain/vue", "./wormchain/build/wormchaind", "sdk/js", "sdk/js-*", "sdk/rust"], ) # docker_build( @@ -901,9 +882,8 @@ if wormchain: if ibc_relayer: docker_build( ref = "ibc-relayer-image", - context = ".", - dockerfile = "./wormchain/ibc-relayer/Dockerfile", - only = [] + context = "wormchain/ibc-relayer", + dockerfile = "wormchain/ibc-relayer/Dockerfile", ) k8s_yaml_with_ns("devnet/ibc-relayer.yaml") diff --git a/relayer/generic_relayer/relayer-engine-v2/Dockerfile b/relayer/generic_relayer/relayer-engine-v2/Dockerfile index 14b4a86f9e..1cf3f669c7 100644 --- a/relayer/generic_relayer/relayer-engine-v2/Dockerfile +++ b/relayer/generic_relayer/relayer-engine-v2/Dockerfile @@ -19,14 +19,14 @@ WORKDIR /home/node/app # Fix git ssh error RUN git config --global url."https://".insteadOf ssh:// -COPY --chown=node:node ./relayer/ethereum/ts-scripts/relayer/config/ ./ethereum/ts-scripts/relayer/config/ +COPY --chown=node:node ./ethereum/ts-scripts/relayer/config/ ./ethereum/ts-scripts/relayer/config/ #Path matters so as to not break imports WORKDIR /home/node/app/relayer/generic_relayer/relayer-engine-v2/ # Only invalidate the npm install step if package.json changed -COPY --chown=node:node /relayer/generic_relayer/relayer-engine-v2/package.json . -COPY --chown=node:node /relayer/generic_relayer/relayer-engine-v2/package-lock.json . +COPY --chown=node:node /generic_relayer/relayer-engine-v2/package.json . +COPY --chown=node:node /generic_relayer/relayer-engine-v2/package-lock.json . # We want to cache node_modules *and* incorporate it into the final image. RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \ @@ -42,7 +42,7 @@ RUN rm -rf node_modules && mv node_modules_cache node_modules ARG dev ENV DEV=$dev -COPY --chown=node:node /relayer/generic_relayer/relayer-engine-v2/ . +COPY --chown=node:node /generic_relayer/relayer-engine-v2/ . diff --git a/sui/Dockerfile b/sui/Dockerfile index b584fa320e..1ed6914b8c 100644 --- a/sui/Dockerfile +++ b/sui/Dockerfile @@ -7,15 +7,15 @@ FROM ghcr.io/wormhole-foundation/sui:1.19.1-mainnet@sha256:97e2e62d43262883b7a5b # RUN sui genesis -f --from-config genesis_config # subsequent runs after committing files from /root/.sui/sui_config/ -COPY sui/devnet/ /root/.sui/sui_config/ +COPY devnet/ /root/.sui/sui_config/ WORKDIR /tmp -COPY sui/scripts/ scripts -COPY sui/wormhole/ wormhole -COPY sui/token_bridge/ token_bridge -COPY sui/examples/ examples -COPY sui/Makefile Makefile +COPY scripts/ scripts +COPY wormhole/ wormhole +COPY token_bridge/ token_bridge +COPY examples/ examples +COPY Makefile Makefile # Copy .env and CLI COPY --from=const-export .env .env diff --git a/sui/Makefile b/sui/Makefile index 0549a0881e..fe550ab55d 100644 --- a/sui/Makefile +++ b/sui/Makefile @@ -12,4 +12,4 @@ test: test-docker: DOCKER_BUILDKIT=1 docker build --progress plain -f ../clients/js/Dockerfile -t cli-gen ../clients/js DOCKER_BUILDKIT=1 docker build --build-arg num_guardians=1 --progress plain -f ../Dockerfile.const -t const-gen .. - DOCKER_BUILDKIT=1 docker build -f Dockerfile .. + DOCKER_BUILDKIT=1 docker build -f Dockerfile . diff --git a/third_party/redis/Dockerfile b/third_party/redis/Dockerfile index 2b91e3ad18..2d17ff75dc 100644 --- a/third_party/redis/Dockerfile +++ b/third_party/redis/Dockerfile @@ -95,9 +95,8 @@ RUN mkdir /data && chown redis:redis /data VOLUME /data WORKDIR /data -COPY . . -RUN chmod 777 /data/third_party/redis/docker-entrypoint.sh -RUN cp /data/third_party/redis/docker-entrypoint.sh /usr/local/bin/ +COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN chmod 777 /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/wormchain/ibc-relayer/Dockerfile b/wormchain/ibc-relayer/Dockerfile index 2791d7b669..89d1975816 100644 --- a/wormchain/ibc-relayer/Dockerfile +++ b/wormchain/ibc-relayer/Dockerfile @@ -13,7 +13,7 @@ RUN tar xzf c30b8d9e0ba6b45f8a576f768cad0777de545cb3.tar.gz WORKDIR relayer-c30b8d9e0ba6b45f8a576f768cad0777de545cb3 RUN make install -COPY ./wormchain/ibc-relayer/chains /chains +COPY chains /chains RUN rly config init RUN rly chains add-dir /chains @@ -21,4 +21,4 @@ RUN rly keys restore localterra default "notice oak worry limit wrap speak medal RUN rly keys restore wormchain default "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius" RUN rly paths new localterra wormchain terra-wormchain -EXPOSE 7597 \ No newline at end of file +EXPOSE 7597