Skip to content

Commit dfe68ee

Browse files
committed
feat: add initial nilchain-devnet docker image
1 parent 2e9d472 commit dfe68ee

File tree

14 files changed

+594
-1
lines changed

14 files changed

+594
-1
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.git
2+
/.github

.github/workflows/docker.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and push docker image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: nilchain-devnet
9+
10+
jobs:
11+
docker-build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Extract metadata (tags, labels) for Docker
20+
id: meta
21+
uses: docker/metadata-action@v4
22+
with:
23+
images: ${{ env.REGISTRY }}/NillionNetwork/${{ env.IMAGE_NAME }}
24+
tags: |
25+
type=ref,event=branch
26+
type=ref,event=tag
27+
flavor: |
28+
latest=false # Ensure 'latest' tag is not generated
29+
30+
- name: Set VERSION environment variable
31+
run: |
32+
# Extract the first tag from the generated tags
33+
TAG=$(echo ${{ steps.meta.outputs.tags }} | cut -d ',' -f 1)
34+
TAG=$(echo $TAG | cut -d ':' -f 2)
35+
echo "VERSION=$TAG" >> $GITHUB_ENV
36+
37+
- name: Build Docker image
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: .
41+
tags: ${{ steps.meta.outputs.tags }}
42+
build-args: |
43+
VERSION=${{ env.VERSION }}
44+
45+
- name: Debug tags
46+
run: |
47+
echo "Generated tags: ${{ steps.meta.outputs.tags }}"
48+
echo "Generated labels: ${{ steps.meta.outputs.labels }}"
49+
50+
- name: List Docker images
51+
run: docker images
52+
53+
- name: Log in to the Container registry
54+
uses: docker/login-action@v2
55+
with:
56+
registry: ${{ env.REGISTRY }}
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Push Docker image
61+
uses: docker/build-push-action@v2
62+
with:
63+
context: .
64+
push: true
65+
tags: ${{ steps.meta.outputs.tags }}
66+
build-args: |
67+
VERSION=${{ env.VERSION }}

.github/workflows/merge.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build image
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docker-build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Build Docker image
13+
uses: docker/build-push-action@v2
14+
id: build
15+
16+
- name: Test image is runnable
17+
run: |
18+
docker run --rm ${{steps.build.outputs.imageid}} config view app
19+
20+

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM ghcr.io/nillionnetwork/nilchaind:v0.2.5
2+
3+
WORKDIR /opt/nilchain
4+
5+
COPY config config
6+
COPY data data
7+
8+
EXPOSE 26648 26649 26650
9+
10+
ENTRYPOINT ["nilchaind", "--home", "/opt/nilchain"]
11+
CMD ["start"]

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
# nilchain-devnet
2-
A preconfigured nilchain docker image to run as a local devnet
2+
3+
A preconfigured single node nilchain docker image to be used as a local devnet for testing purposes.
4+
5+
## Ports
6+
7+
The nilchain instance can be reached at the following ports:
8+
9+
| Protocol | Port |
10+
|----------|-------|
11+
| JSON RPC | 26648 |
12+
| gRPC | 26649 |
13+
| REST | 26650 |
14+
15+
## Stash account
16+
17+
There's a single "stash" account that contains lots of funds using private key
18+
`97f49889fceed88a9cdddb16a161d13f6a12307c2b39163f3c3c397c3c2d2434`.
19+
20+
## Overriding configurations
21+
22+
Configurations can be overridden by using an environment variable named like:
23+
24+
```bash
25+
NILCHAIND_${CONFIG_FILE_SECTION}_${VARIABLE}
26+
```
27+
28+
For example, one can change the commit timeout by running the container like this:
29+
30+
```bash
31+
docker run --rm -e NILCHAIND_CONSENSUS_TIMEOUT_COMMIT=200ms ghcr.io/nillionnetwork/nilchain-devnet:latest
32+
```

config/addrbook.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"key": "2df7e9ed510558a71905f92c",
3+
"addrs": []
4+
}
5+

config/app.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
minimum-gas-prices = "0stake"
2+
query-gas-limit = "0"
3+
4+
[api]
5+
address = "tcp://0.0.0.0:26650"
6+
7+
[grpc]
8+
address = "0.0.0.0:26649"
9+
enable = true
10+
11+
[rpc]
12+
laddr = "tcp://0.0.0.0:26648"
13+
14+
[grpc-web]
15+
enable = true
16+

config/client.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
chain-id = "nillion-chain-devnet"
2+
keyring-backend = "test"
3+
broadcast-mode = "sync"

config/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[consensus]
2+
create_empty_blocks = true
3+
create_empty_blocks_interval = "5s"
4+
skip_timeout_commit = false
5+
timeout_commit = "1s"

0 commit comments

Comments
 (0)