Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.git
/.github
67 changes: 67 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and push docker image

on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: nilchain-devnet

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/NillionNetwork/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=false # Ensure 'latest' tag is not generated

- name: Set VERSION environment variable
run: |
# Extract the first tag from the generated tags
TAG=$(echo ${{ steps.meta.outputs.tags }} | cut -d ',' -f 1)
TAG=$(echo $TAG | cut -d ':' -f 2)
echo "VERSION=$TAG" >> $GITHUB_ENV

- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
build-args: |
VERSION=${{ env.VERSION }}

- name: Debug tags
run: |
echo "Generated tags: ${{ steps.meta.outputs.tags }}"
echo "Generated labels: ${{ steps.meta.outputs.labels }}"

- name: List Docker images
run: docker images

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
VERSION=${{ env.VERSION }}
20 changes: 20 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build image
on:
pull_request:
push:
branches:
- main

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Build Docker image
uses: docker/build-push-action@v2
id: build

- name: Test image is runnable
run: |
docker run --rm ${{steps.build.outputs.imageid}} config view app


11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ghcr.io/nillionnetwork/nilchaind:v0.2.5

WORKDIR /opt/nilchain

COPY config config
COPY data data

EXPOSE 26648 26649 26650

ENTRYPOINT ["nilchaind", "--home", "/opt/nilchain"]
CMD ["start"]
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# nilchain-devnet
A preconfigured nilchain docker image to run as a local devnet

A preconfigured single node nilchain docker image to be used as a local devnet for testing purposes.

## Ports

The nilchain instance can be reached at the following ports:

| Protocol | Port |
|----------|-------|
| JSON RPC | 26648 |
| gRPC | 26649 |
| REST | 26650 |

## Stash account

There's a single "stash" account that contains lots of funds using private key
`97f49889fceed88a9cdddb16a161d13f6a12307c2b39163f3c3c397c3c2d2434`.

## Overriding configurations

Configurations can be overridden by using an environment variable named like:

```bash
NILCHAIND_${CONFIG_FILE_SECTION}_${VARIABLE}
```

For example, one can change the commit timeout by running the container like this:

```bash
docker run --rm -e NILCHAIND_CONSENSUS_TIMEOUT_COMMIT=200ms ghcr.io/nillionnetwork/nilchain-devnet:latest
```
5 changes: 5 additions & 0 deletions config/addrbook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"key": "2df7e9ed510558a71905f92c",
"addrs": []
}

13 changes: 13 additions & 0 deletions config/app.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
minimum-gas-prices = "0stake"
query-gas-limit = "0"

[api]
address = "tcp://0.0.0.0:26650"

[grpc]
address = "0.0.0.0:26649"
enable = true

[grpc-web]
enable = true

4 changes: 4 additions & 0 deletions config/client.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
chain-id = "nillion-chain-devnet"
keyring-backend = "test"
node = "tcp://localhost:26657"
broadcast-mode = "sync"
8 changes: 8 additions & 0 deletions config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[consensus]
create_empty_blocks = true
create_empty_blocks_interval = "5s"
skip_timeout_commit = false
timeout_commit = "1s"

[rpc]
laddr = "tcp://0.0.0.0:26648"
Loading
Loading