Remove go-nitro repo dependency from nitro-node and bridge stacks (#12)
Part of [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270) - Remove `go-nitro` repo from `bridge` and `nitro-node` stacks - Add a separate image for Nitro contracts deployment - Update `go-nitro` Dockerfile to: - Fetch `nitro` and `bridge` binaries from <https://git.vdb.to/cerc-io/nitro> instead of building from source - Use `ubuntu:latest` as base image instead of `deban:bullsye-slim` - Update `nitro-client` Dockerfile to: - Install `nitro-rpc-client` package from `git.vdb.to/cerc-io` instead of building from source Co-authored-by: Adw8 <adwaitgharpure@gmail.com> Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Reviewed-on: #12 Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to> Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
This commit is contained in:
parent
034778ebeb
commit
ceae9fe8d4
@ -99,6 +99,9 @@
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
||||
|
||||
# Build nitro-contracts container image
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
|
||||
```
|
||||
|
||||
- Create a deployment spec-file for Alice's L1 nitro-node:
|
||||
@ -264,7 +267,7 @@
|
||||
|
||||
```bash
|
||||
export GETH_CHAIN_ID="1212"
|
||||
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")
|
||||
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.address' /app/deployment/nitro-addresses.json")
|
||||
|
||||
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
|
||||
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
||||
@ -276,7 +279,7 @@
|
||||
# Send tokens to Alice
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth"
|
||||
|
||||
#Send tokens to Charlie
|
||||
# Send tokens to Charlie
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth"
|
||||
```
|
||||
|
||||
@ -438,7 +441,7 @@
|
||||
```bash
|
||||
export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
export GETH_CHAIN_ID="1212"
|
||||
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")
|
||||
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.address' /app/deployment/nitro-addresses.json")
|
||||
```
|
||||
|
||||
- Create ledger channel between A and Bridge with custom token
|
||||
|
@ -96,6 +96,9 @@
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
||||
|
||||
# Build nitro-contracts container image
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
|
||||
```
|
||||
|
||||
## Run
|
||||
|
@ -3,7 +3,8 @@ name: nitro-contracts
|
||||
services:
|
||||
# Optionally deploys the Nitro contracts
|
||||
nitro-contracts:
|
||||
image: cerc/nitro-client:local
|
||||
image: cerc/nitro-contracts:local
|
||||
working_dir: /app
|
||||
restart: on-failure
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
|
@ -43,4 +43,4 @@ EOF
|
||||
|
||||
# Start bridge
|
||||
echo "Starting nitro-bridge"
|
||||
./nitro-bridge -config $bridge_config_file
|
||||
./bridge -config $bridge_config_file
|
||||
|
@ -1,29 +1,25 @@
|
||||
FROM golang:1.22-bullseye AS builder
|
||||
FROM ubuntu:latest
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y jq netcat-traditional ca-certificates curl
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy files into image
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# Install mkcert
|
||||
RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
|
||||
RUN chmod +x mkcert-v*-linux-amd64
|
||||
RUN cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
|
||||
|
||||
RUN go mod tidy
|
||||
# Download binaries
|
||||
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/latest/nitro
|
||||
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/latest/bridge
|
||||
|
||||
# Build the binary
|
||||
RUN go build -v -o nitro .
|
||||
RUN go build -o nitro-bridge cmd/start-bridge/main.go
|
||||
# Make binaries executable
|
||||
RUN chmod +x ./nitro
|
||||
RUN chmod +x ./bridge
|
||||
|
||||
|
||||
# Reduce image size
|
||||
FROM debian:bullseye-slim
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y jq netcat ca-certificates
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/nitro .
|
||||
COPY --from=builder /app/nitro-bridge .
|
||||
COPY --from=builder /usr/local/bin/mkcert /usr/local/bin/mkcert
|
||||
# Verify that binaries are correctly setup
|
||||
RUN ./nitro help
|
||||
RUN ./bridge help
|
||||
|
@ -4,10 +4,7 @@ RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN echo "Installing dependencies" && \
|
||||
yarn && yarn build
|
||||
RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
|
||||
RUN echo "Installing nitro-rpc-client" && \
|
||||
npm install -g ./packages/nitro-rpc-client
|
||||
npm install -g @cerc-io/nitro-rpc-client
|
||||
|
@ -0,0 +1,10 @@
|
||||
FROM node:18.17.1-alpine3.18
|
||||
|
||||
RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN echo "Installing dependencies" && \
|
||||
yarn && yarn build
|
9
stack-orchestrator/container-build/cerc-nitro-contracts/build.sh
Executable file
9
stack-orchestrator/container-build/cerc-nitro-contracts/build.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/nitro-contracts
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/nitro-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
@ -8,12 +8,6 @@
|
||||
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
|
||||
```
|
||||
|
||||
- Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories
|
||||
```
|
||||
|
||||
- Build container images:
|
||||
|
||||
```bash
|
||||
|
@ -2,10 +2,9 @@ version: "1.0"
|
||||
name: bridge
|
||||
description: "Nitro bridge with contracts deployment and nitro-rpc-client"
|
||||
repos:
|
||||
- github.com/cerc-io/go-nitro
|
||||
containers:
|
||||
- cerc/nitro-client
|
||||
- cerc/go-nitro
|
||||
- cerc/nitro-client
|
||||
pods:
|
||||
- nitro-bridge
|
||||
- nitro-rpc-client
|
||||
|
@ -11,8 +11,9 @@
|
||||
- Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories --git-ssh --pull
|
||||
```
|
||||
Make sure you have access to the `go-nitro` repository
|
||||
|
||||
- Build container images:
|
||||
|
||||
|
@ -4,6 +4,6 @@ description: "Deploy nitro contracts"
|
||||
repos:
|
||||
- github.com/cerc-io/go-nitro
|
||||
containers:
|
||||
- cerc/nitro-client
|
||||
- cerc/nitro-contracts
|
||||
pods:
|
||||
- nitro-contracts
|
||||
|
@ -8,14 +8,6 @@
|
||||
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
|
||||
```
|
||||
|
||||
- Clone required repositories
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories
|
||||
```
|
||||
|
||||
Note: Replace path to nitro stack with actual path
|
||||
|
||||
- Build the container image
|
||||
|
||||
```bash
|
||||
|
@ -2,7 +2,6 @@ version: "1.0"
|
||||
name: nitro-node
|
||||
description: "Nitro node with nitro-rpc-client"
|
||||
repos:
|
||||
- github.com/cerc-io/go-nitro
|
||||
containers:
|
||||
- cerc/go-nitro
|
||||
- cerc/nitro-client
|
||||
|
Loading…
Reference in New Issue
Block a user