Skip to content

Commit 4ff5512

Browse files
authored
Merge pull request #9 from 0KnowledgeNetwork/8-set-protokit-sequencer-url
set protokit sequencer url
2 parents 6aeacd7 + 4690168 commit 4ff5512

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed

.github/workflows/docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
branches:
66
- main
7+
paths-ignore:
8+
- '**/*.md'
79
push:
810
branches:
911
- main
@@ -95,6 +97,7 @@ jobs:
9597
cache-from: type=gha
9698
cache-to: type=gha,mode=max
9799
context: ./appchain-agent
100+
file: ./appchain-agent/docker/Dockerfile
98101
tags: ${{ env.IMAGE_TEST }}:test
99102
load: true
100103

@@ -108,6 +111,7 @@ jobs:
108111
context-appchain=./appchain
109112
context-protokit=./protokit
110113
context: ./appchain-agent
114+
file: ./appchain-agent/docker/Dockerfile
111115
tags: ${{ steps.meta.outputs.tags }}
112116
labels: ${{ steps.meta.outputs.labels }}
113117
platforms: linux/amd64

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ image:
55
docker build \
66
--build-context context-appchain=../appchain \
77
--build-context context-protokit=../protokit \
8-
--file Dockerfile \
8+
--file docker/Dockerfile \
99
--tag $(docker_image) \
1010
.

bin/network-init.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ while [ ! -S ${socket} ]; do sleep 1; done
4040

4141
appchain () {
4242
echo "$@" | tee >(cat >&2) | nc -U -q 0 ${socket}
43-
sleep 0.2s
43+
sleep 1s
4444
}
4545

4646
appchain admin setAdmin
4747
appchain nodes setRegistrationStake 0
4848
appchain nodes openRegistration
4949
appchain networks register ${network_id} ${network_build}
50-
sleep 1s # avoid nonce collision from slower register command (IPFS)
5150
appchain networks setActive ${network_id}
5251

5352
kill ${PID}

Dockerfile renamed to docker/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ WORKDIR /app/appchain-agent
1010
# Stage 1: Build
1111
FROM base AS builder
1212

13-
COPY package.json pnpm-lock.yaml ./
14-
1513
COPY --from=context-protokit / /app/protokit
1614
RUN --mount=type=cache,id=npm,target=/root/.npm \
1715
cd /app/protokit \
@@ -25,6 +23,7 @@ RUN --mount=type=cache,id=pnpm,target=${PNPM_HOME}/store \
2523
&& pnpm install --frozen-lockfile \
2624
&& pnpm build
2725

26+
COPY package.json pnpm-lock.yaml /app/appchain-agent/
2827
RUN --mount=type=cache,id=pnpm,target=${PNPM_HOME}/store \
2928
cd /app/appchain-agent \
3029
&& pnpm install --frozen-lockfile
@@ -36,6 +35,8 @@ RUN pnpm run build
3635
# Stage 2: Production image
3736
FROM base AS runner
3837

38+
ENV NODE_ENV=production
39+
3940
# install deps used by scripts
4041
RUN apk add --no-cache \
4142
bash \
@@ -50,4 +51,8 @@ RUN --mount=type=cache,id=pnpm,target=${PNPM_HOME}/store pnpm install --prod --f
5051

5152
COPY bin ./bin
5253

54+
COPY --chmod=0555 ./docker/entry.sh ./entry.sh
55+
5356
USER node
57+
58+
ENTRYPOINT ["./entry.sh"]

docker/entry.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# map env var name to the one used internally
4+
test ! -z "${URL_APPCHAIN_SEQUENCER}" \
5+
&& echo "URL_APPCHAIN_SEQUENCER=${URL_APPCHAIN_SEQUENCER}" \
6+
&& export NEXT_PUBLIC_PROTOKIT_GRAPHQL_URL="${URL_APPCHAIN_SEQUENCER}"
7+
8+
exec "$@"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ if (!opts.help) {
138138
console.log(`Using key from ${opts.key}:`, publicKey.toBase58());
139139
}
140140

141-
console.log("opts", opts);
141+
if (opts.debug && !opts.help) console.log("opts", opts);
142142

143143
// fire up the appchain client!
144144
await client.start();

0 commit comments

Comments
 (0)