Skip to content

Commit

Permalink
tilt: narrow contexts and set only for ones with root
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Dec 20, 2024
1 parent 1049ad5 commit dd5b21c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 56 deletions.
60 changes: 20 additions & 40 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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",
)

Expand Down Expand Up @@ -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)}
)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions relayer/generic_relayer/relayer-engine-v2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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/ .



Expand Down
12 changes: 6 additions & 6 deletions sui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
5 changes: 2 additions & 3 deletions third_party/redis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
4 changes: 2 additions & 2 deletions wormchain/ibc-relayer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ 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
RUN rly keys restore localterra 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" --coin-type 330
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
EXPOSE 7597

0 comments on commit dd5b21c

Please sign in to comment.