Skip to content

Commit

Permalink
conditional tunnels
Browse files Browse the repository at this point in the history
  • Loading branch information
arsen3d committed Jun 11, 2024
1 parent 7a09ab8 commit 2b466d6
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions docker/chain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG expose_via=local
ARG arch=amd64

FROM docker:24.0.5-dind AS base
ARG admin_address="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"

ARG arch=amd64
ARG cloudflare_token_http="not-a-token"
ARG cloudflare_token_ws="not-a-token"

RUN apk update
RUN apk add bash
Expand All @@ -12,18 +13,18 @@ RUN apk add npm
WORKDIR /l2chain
COPY . .
RUN touch run
RUN echo "#!/bin/bash" >> run
RUN echo "dockerd-entrypoint.sh & " >> run
RUN echo "until docker info >/dev/null 2>&1; do " >> run
RUN echo " echo 'Waiting for Docker to start...'" >> run
RUN echo " sleep 1" >> run
RUN echo "done" >> run


RUN echo "docker pull offchainlabs/nitro-node:v2.3.4-b4cc111 " >> run

RUN echo "docker run -d --name devnet -p 0.0.0.0:8547:8547 -p 0.0.0.0:8548:8548 offchainlabs/nitro-node:v2.3.4-b4cc111 "\
" --init.dev-init " \
" --init.dev-init-address 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 "\
" --init.dev-init-address $admin_address "\
" --node.dangerous.no-l1-listener "\
" --node.parent-chain-reader.enable=false "\
" --parent-chain.id=1337 "\
Expand Down Expand Up @@ -55,16 +56,22 @@ RUN echo "npx hardhat run scripts/fund-services-ether.ts --network devnet" >> r
RUN echo "npx hardhat run scripts/fund-services-tokens.ts --network devnet " >> run
RUN echo "npx hardhat run scripts/print-l2-config.ts --network devnet" >> run

FROM base AS expose-cloudflare
ARG cloudflare_token_http="not-a-token"
ARG cloudflare_token_ws="not-a-token"

RUN wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
RUN echo "cd .." >> run
RUN echo "./cloudflared-linux-amd64 tunnel run --token $cloudflare_token_http &" >> run
RUN echo "./cloudflared-linux-amd64 tunnel run --token $cloudflare_token_ws &" >> run
RUN chmod +x cloudflared-linux-amd64

RUN echo "tail -f /dev/null" >> run
FROM base AS expose-local
RUN echo "cd .." >> run

RUN chmod +x cloudflared-linux-amd64
FROM expose-$expose_via AS FINAL
RUN chmod +x run

RUN echo "tail -f /dev/null" >> run
ENTRYPOINT ["bash", "./run"]

#example use:
Expand Down

0 comments on commit 2b466d6

Please sign in to comment.