Skip to content

Commit 48c5a25

Browse files
authored
Revamp ci&image flow (#304)
* Revamp ci&image flow * Zenlink dependency as forked
1 parent f2e99ee commit 48c5a25

12 files changed

Lines changed: 39 additions & 58 deletions

File tree

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ jobs:
2222
uses: actions/checkout@v2
2323
with:
2424
submodules: recursive
25-
- name: Add SSH key
26-
uses: webfactory/[email protected]
27-
with:
28-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
2925
- name: Install toolchain
3026
uses: actions-rs/toolchain@v1
3127
with:

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Check to latest commit
2727
uses: actions/checkout@v2
2828
with:
29-
submodules: recursive
29+
fetch-depth: 0
3030
- name: Set up Docker Buildx
3131
uses: docker/setup-buildx-action@v1
3232
with:

.maintain/build-image.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@ if [[ -z "$1" ]] ; then
77
VERSION=$(git rev-parse --short HEAD)
88
fi
99

10-
eval $(ssh-agent)
11-
ssh-add ~/.ssh/github_actions
12-
DOCKER_BUILDKIT=1 docker build --ssh default -t "$NODE_NAME:$VERSION" .
13-
docker push "$NODE_NAME:$VERSION"
14-
docker push $NODE_NAME:latest
10+
DOCKER_BUILDKIT=1 docker build -t "$NODE_NAME:$VERSION" .

.maintain/build-wasm.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ RUSTC_VERSION="1.53.0"
66
EXTRA_ARGS='--json'
77
BIN_PATH=$(dirname $(readlink -f $0))
88
WORK_PATH=${BIN_PATH}/..
9-
eval $(ssh-agent)
10-
ssh-add ~/.ssh/github_actions
119

1210
RUNTIME=$1
1311

1412
docker run --rm -it \
1513
-e PACKAGE=$RUNTIME-runtime \
1614
-e VERBOSE=1 \
1715
-e CARGO_TERM_COLOR=always \
18-
-e SSH_AUTH_SOCK=/ssh-agent \
19-
-v $(readlink -f $SSH_AUTH_SOCK):/ssh-agent \
2016
-v ${TMPDIR}/cargo:/cargo-home \
2117
-v ${WORK_PATH}:/build \
2218
paritytech/srtool:${RUSTC_VERSION} build ${EXTRA_ARGS}

.maintain/publish-image.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
VERSION=$1
4+
NODE_NAME=bifrostnetwork/bifrost
5+
6+
if [[ -z "$1" ]] ; then
7+
VERSION=$(git rev-parse --short HEAD)
8+
fi
9+
10+
docker push "$NODE_NAME:$VERSION"
11+
docker push $NODE_NAME:latest

Cargo.lock

Lines changed: 3 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate",
189189
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" }
190190
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" }
191191

192-
zenlink-protocol = { git = "ssh://git@github.com/bifrost-finance/Zenlink-DEX-Module", branch = "polkadot-v0.9.9" }
193-
zenlink-protocol-rpc = { git = "ssh://git@github.com/bifrost-finance/Zenlink-DEX-Module", branch = "polkadot-v0.9.9" }
194-
zenlink-protocol-runtime-api = { git = "ssh://git@github.com/bifrost-finance/Zenlink-DEX-Module", branch = "polkadot-v0.9.9" }
192+
zenlink-protocol = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "polkadot-v0.9.9"}
193+
zenlink-protocol-rpc = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "polkadot-v0.9.9" }
194+
zenlink-protocol-runtime-api = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "polkadot-v0.9.9" }
195195

196196
orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "8d5432c3458702a7df14b374bddde43a2a20aa43" }
197197
orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "8d5432c3458702a7df14b374bddde43a2a20aa43" }

Dockerfile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,39 @@ RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-17
2323

2424
WORKDIR /app
2525
COPY . /app
26-
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
2726

28-
RUN --mount=type=ssh export PATH="$PATH:$HOME/.cargo/bin" && \
27+
RUN export PATH="$PATH:$HOME/.cargo/bin" && \
2928
make build-all-release
3029

3130
# ===== SECOND STAGE ======
3231

3332
FROM ubuntu:20.04
34-
WORKDIR /bifrost
3533

3634
RUN rm -rf /usr/share && \
3735
rm -rf /usr/lib/python* && \
3836
useradd -m -u 1000 -U -s /bin/sh -d /bifrost bifrost && \
39-
mkdir -p /bifrost/.local/data && \
4037
chown -R bifrost:bifrost /bifrost && \
41-
ln -s /bifrost/.local/data /data
38+
mkdir -p /bifrost/.local/share && \
39+
mkdir /data && \
40+
chown -R bifrost:bifrost /data && \
41+
ln -s /data /bifrost/.local/share/bifrost && \
42+
mkdir /spec && \
43+
chown -R bifrost:bifrost /spec && \
44+
ln -s /spec /bifrost/.local/share/spec
4245

46+
USER bifrost
4347
COPY --from=builder /app/target/release/bifrost /usr/local/bin
44-
COPY ./node/service/res/asgard.json /bifrost
45-
COPY ./node/service/res/bifrost.json /bifrost
48+
COPY ./node/service/res/asgard.json /spec
49+
COPY ./node/service/res/bifrost.json /spec
4650

4751
# checks
4852
RUN ldd /usr/local/bin/bifrost && \
4953
/usr/local/bin/bifrost --version
5054

51-
5255
USER bifrost
5356
EXPOSE 30333 9933 9944
5457

5558
VOLUME ["/data"]
59+
VOLUME ["/spec"]
5660

5761
ENTRYPOINT ["/usr/local/bin/bifrost"]

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ docker-compose up -d --build
127127
### Create `bifrost-fullnode` directory, generate `node-key` and get `bifrost.json`
128128

129129
```sh
130-
mkdir -p ~/bifrost-fullnode/network
131-
subkey generate-node-key --file ~/bifrost-fullnode/network/node-key
132-
wget -O ~/bifrost-fullnode/bifrost.json https://github.com/bifrost-finance/bifrost/releases/download/bifrost-v0.8.0/bifrost.json
130+
mkdir -p ~/node-key
131+
subkey generate-node-key --file ~/node-key/bifrost.key
133132
```
134133

135134
### Start the node with docker
@@ -138,16 +137,16 @@ Replace your-fullnode-name
138137
```sh
139138
docker pull bifrostnetwork/bifrost:v0.8.3
140139
docker run -d \
141-
-v ~/bifrost-fullnode:/bifrost \
140+
-v ~/node-key:/node-key \
142141
-p 9944:9944 \
143142
-p 9933:9933 \
144143
-p 30333:30333 \
145144
-p 9615:9615 \
146145
bifrostnetwork/bifrost:v0.8.3 \
147146
--name your-fullnode-name \
148-
--base-path "/bifrost" \
149-
--node-key-file "/bifrost/network/node-key" \
150-
--chain "/bifrost/bifrost.json" \
147+
--base-path "/data" \
148+
--node-key-file "/node-key/bifrost.key" \
149+
--chain "/spec/bifrost.json" \
151150
--parachain-id 2001 \
152151
--pruning=archive \
153152
--prometheus-external \

node/service/res/asgard.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"relay_chain": "westend",
2020
"para_id": 2001,
2121
"consensusEngine": null,
22-
"lightSyncState": null,
2322
"codeSubstitutes": {},
2423
"genesis": {
2524
"raw": {

0 commit comments

Comments
 (0)