-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make a txsim binary build from Makefile and dockerfile
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,11 @@ jobs: | |
uses: celestiaorg/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length | ||
with: | ||
dockerfile: Dockerfile | ||
|
||
docker-txsim-build: | ||
permissions: | ||
contents: write | ||
packages: write | ||
uses: celestiaorg/.github/.github/workflows/[email protected] | ||
with: | ||
dockerfile: docker/Dockerfile_txsim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# stage 1 Generate celestia-appd Binary | ||
FROM docker.io/golang:1.20.5-alpine3.17 as builder | ||
# hadolint ignore=DL3018 | ||
RUN apk update && apk add --no-cache \ | ||
gcc \ | ||
git \ | ||
make \ | ||
musl-dev | ||
COPY . /celestia-app | ||
WORKDIR /celestia-app | ||
# we need the appd build as we might want to create an account | ||
# internally for txsimulation | ||
RUN make build | ||
RUN make txsim-build | ||
|
||
# stage 2 | ||
FROM docker.io/alpine:3.18.2 | ||
|
||
# Read here why UID 10001: https://github.com/hexops/dockerfile/blob/main/README.md#do-not-use-a-uid-below-10000 | ||
ARG UID=10001 | ||
ARG USER_NAME=celestia | ||
|
||
ENV CELESTIA_HOME=/home/${USER_NAME} | ||
|
||
# hadolint ignore=DL3018 | ||
RUN apk update && apk add --no-cache \ | ||
bash \ | ||
curl \ | ||
jq \ | ||
# Creates a user with $UID and $GID=$UID | ||
&& adduser ${USER_NAME} \ | ||
-D \ | ||
-g ${USER_NAME} \ | ||
-h ${CELESTIA_HOME} \ | ||
-s /sbin/nologin \ | ||
-u ${UID} | ||
|
||
# Copy in the binary | ||
COPY --from=builder /celestia-app/build/celestia-appd /bin/celestia-appd | ||
COPY --from=builder /celestia-app/build/txsim /bin/txsim | ||
|
||
COPY --chown=${USER_NAME}:${USER_NAME} docker/txsim.sh /opt/entrypoint.sh | ||
|
||
USER ${USER_NAME} | ||
|
||
# p2p, rpc and prometheus port | ||
EXPOSE 26656 26657 1317 9090 | ||
|
||
ENTRYPOINT [ "/bin/bash", "/opt/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = 'create-key' ]; then | ||
echo "Creating a new keyring-test for the txsim" | ||
exec /bin/celestia-appd keys add sim --keyring-backend test --home /home/celestia | ||
fi | ||
|
||
# TODO: This is a temporary solution to get the txsim working | ||
# Please define your own entrypoint.sh when running a txsim's dockerimage | ||
txsim --help | ||
|
||
# example of running a txsim on robusta chain | ||
# txsim --key-path /home/celestia \ | ||
# --rpc-endpoints http://consensus-validator-robusta-rc6.celestia-robusta.com:26657,http://consensus-full-robusta-rc6.celestia-robusta.com:26657 \ | ||
# --grpc-endpoints consensus-validator-robusta-rc6.celestia-robusta.com:9090 --poll-time 10s --blob 10 --seed 100 --send 10 --stake 2 |