-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Start to spike a dockerized version. * Create docker.yml (#11) Co-authored-by: Alex Lynham <alex@lynh.am>
- Loading branch information
Showing
5 changed files
with
120 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
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,36 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/juno:latest |
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,41 @@ | ||
# docker build . -t cosmoscontracts/juno:latest | ||
# docker run --rm -it cosmoscontracts/juno:latest /bin/sh | ||
FROM golang:1.16-alpine3.12 AS go-builder | ||
|
||
# this comes from standard alpine nightly file | ||
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile | ||
# with some changes to support our toolchain, etc | ||
RUN set -eux; apk add --no-cache ca-certificates build-base; | ||
|
||
RUN apk add git | ||
# NOTE: add these to run with LEDGER_ENABLED=true | ||
# RUN apk add libusb-dev linux-headers | ||
|
||
WORKDIR /code | ||
COPY . /code/ | ||
|
||
# See https://github.com/CosmWasm/wasmvm/releases | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/v0.14.0/libwasmvm_muslc.a /lib/libwasmvm_muslc.a | ||
RUN sha256sum /lib/libwasmvm_muslc.a | grep 220b85158d1ae72008f099a7ddafe27f6374518816dd5873fd8be272c5418026 | ||
|
||
# force it to use static lib (from above) not standard libgo_cosmwasm.so file | ||
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc make build | ||
|
||
# -------------------------------------------------------- | ||
FROM alpine:3.12 | ||
|
||
COPY --from=go-builder /code/bin/junod /usr/bin/junod | ||
|
||
COPY docker/* /opt/ | ||
RUN chmod +x /opt/*.sh | ||
|
||
WORKDIR /opt | ||
|
||
# rest server | ||
EXPOSE 1317 | ||
# tendermint p2p | ||
EXPOSE 26656 | ||
# tendermint rpc | ||
EXPOSE 26657 | ||
|
||
CMD ["/usr/bin/junod", "version"] |
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,9 @@ | ||
#!/bin/sh | ||
|
||
if test -n "$1"; then | ||
# need -R not -r to copy hidden files | ||
cp -R "$1/.junod" /root | ||
fi | ||
|
||
mkdir -p /root/log | ||
junod start --rpc.laddr tcp://0.0.0.0:26657 --trace |
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,33 @@ | ||
#!/bin/sh | ||
#set -o errexit -o nounset -o pipefail | ||
|
||
PASSWORD=${PASSWORD:-1234567890} | ||
STAKE=${STAKE_TOKEN:-ustake} | ||
FEE=${FEE_TOKEN:-ucosm} | ||
CHAIN_ID=${CHAIN_ID:-testing} | ||
MONIKER=${MONIKER:-node001} | ||
|
||
junod init --chain-id "$CHAIN_ID" "$MONIKER" | ||
# staking/governance token is hardcoded in config, change this | ||
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.junod/config/genesis.json | ||
# this is essential for sub-1s block times (or header times go crazy) | ||
sed -i 's/"time_iota_ms": "1000"/"time_iota_ms": "10"/' "$HOME"/.junod/config/genesis.json | ||
|
||
if ! junod keys show validator; then | ||
(echo "$PASSWORD"; echo "$PASSWORD") | junod keys add validator | ||
fi | ||
# hardcode the validator account for this instance | ||
echo "$PASSWORD" | junod add-genesis-account validator "1000000000$STAKE,1000000000$FEE" | ||
|
||
# (optionally) add a few more genesis accounts | ||
for addr in "$@"; do | ||
echo $addr | ||
junod add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE" | ||
done | ||
|
||
# submit a genesis validator tx | ||
## Workraround for https://github.com/cosmos/cosmos-sdk/issues/8251 | ||
(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | junod gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" --amount="250000000$STAKE" | ||
## should be: | ||
# (echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | junod gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" | ||
junod collect-gentxs |