diff --git a/docker/pokt-net/dev-tm/Dockerfile b/docker/pokt-net/dev-tm/Dockerfile index 186fe37..1eaa0f7 100644 --- a/docker/pokt-net/dev-tm/Dockerfile +++ b/docker/pokt-net/dev-tm/Dockerfile @@ -58,13 +58,15 @@ RUN mkdir -p /home/app/.pocket/config RUN chown -R app /home/app/.pocket RUN chown -R app /go +# Build the pocket main binary using the mainline dependencies RUN cd ${POCKET_PATH} \ && go build -tags cleveldb -o ${GOPATH}/bin/pocket app/cmd/pocket_core/main.go -# Overwrite go.mod files for local development. +# Overwrite go.mod files for local development COPY ${POCKET_E2E_STACK_RELATIVE_PATH}/go.mod.local $POCKET_ROOT/go.mod.core RUN chmod 654 $POCKET_ROOT/go.mod.core +# Overwrite go.mod files for local development COPY ${POCKET_E2E_STACK_RELATIVE_PATH}/go.mod.tendermint $POCKET_ROOT/go.mod.tendermint RUN chmod 654 $POCKET_ROOT/go.mod.tendermint diff --git a/docker/pokt-net/dev-tm/entrypoint-dev.sh b/docker/pokt-net/dev-tm/entrypoint-dev.sh index 22063e3..0789244 100755 --- a/docker/pokt-net/dev-tm/entrypoint-dev.sh +++ b/docker/pokt-net/dev-tm/entrypoint-dev.sh @@ -4,14 +4,13 @@ set -e mkdir -p /home/app/.pocket/config -if [ -n "${POCKET_CORE_GENESIS}" ] ; then - echo "${POCKET_CORE_GENESIS}" > /home/app/.pocket/config/genesis.json +if [ -n "${POCKET_CORE_GENESIS}" ]; then + echo "${POCKET_CORE_GENESIS}" >/home/app/.pocket/config/genesis.json fi # NOTE: The default `chains.json` does not support all the chains in Pocket mainnet. -if [ -n "${POCKET_CORE_CHAINS}" ] ; then - echo "${POCKET_CORE_CHAINS}" > /home/app/.pocket/config/chains.json +if [ -n "${POCKET_CORE_CHAINS}" ]; then + echo "${POCKET_CORE_CHAINS}" >/home/app/.pocket/config/chains.json fi - /usr/bin/expect /home/app/command.sh $@ diff --git a/docker/pokt-net/dev-tm/prepare-tendermint.sh b/docker/pokt-net/dev-tm/prepare-tendermint.sh index e817def..08610b0 100755 --- a/docker/pokt-net/dev-tm/prepare-tendermint.sh +++ b/docker/pokt-net/dev-tm/prepare-tendermint.sh @@ -1,23 +1,31 @@ #!/bin/sh -if [[ -f "$POCKET_ROOT/go.mod.tendermint" ]]; then +echo "Called prepare-tendermint.sh" + +# if [[ -f "$POCKET_ROOT/go.mod.tendermint" ]]; then +if [[ -f "/dev/tendermint.built" ]]; then + touch "/dev/tendermint.built" + echo "Installing dependencies for tendermint..." # Doing a `cp` here errors; concurrency issue - mv $POCKET_ROOT/go.mod.tendermint $TENDERMINT_PATH/go.mod + cp -f $POCKET_ROOT/go.mod.tendermint $TENDERMINT_PATH/go.mod cd $TENDERMINT_PATH - echo "Installing dependencies for tendermint..." - # go mod vendor + # Need to update vendor/module.txt to the local dev paths + go mod tidy && go mod vendor + # Need to get the dependencies in the docker container go mod download fi - cd $TENDERMINT_PATH go build cmd/tendermint/main.go -if [[ -f "$POCKET_ROOT/go.mod.core" ]]; then +if [[ -f "/dev/core.built" ]]; then + touch "/dev/core.built" + echo "Installing dependencies for core..." # Doing a `mv` here errors; can't preserve ownershi - cp $POCKET_ROOT/go.mod.core $POCKET_PATH/go.mod + cp -f $POCKET_ROOT/go.mod.core $POCKET_PATH/go.mod cd $POCKET_PATH - echo "Installing dependencies for core..." - # go mod vendor + # Need to update vendor/module.txt to the local dev paths + go mod tidy && go mod vendor + # Need to get the dependencies in the docker container go mod download fi diff --git a/stacks/pokt-net/dev-tm/stack.yml b/stacks/pokt-net/dev-tm/stack.yml index d57b7ec..b99c835 100644 --- a/stacks/pokt-net/dev-tm/stack.yml +++ b/stacks/pokt-net/dev-tm/stack.yml @@ -33,7 +33,11 @@ services: - ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json - ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json - "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor" - "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor" networks: - poktnet @@ -69,7 +73,11 @@ services: - ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json - ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json - "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor" - "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor" networks: - poktnet @@ -105,7 +113,11 @@ services: - ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json - ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json - "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor" - "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor" networks: - poktnet @@ -141,7 +153,11 @@ services: - ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json - ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json - "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor" - "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod" + - "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor" networks: - poktnet diff --git a/stacks/pokt-net/dev-tm/up.sh b/stacks/pokt-net/dev-tm/up.sh index 67569fa..5f30ec5 100755 --- a/stacks/pokt-net/dev-tm/up.sh +++ b/stacks/pokt-net/dev-tm/up.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash -if [ -z $CWD ]; -then - echo "Expected CWD env var, nothing was exported"; - exit 1; +if [ -z $CWD ]; then + echo "Expected CWD env var, nothing was exported" + exit 1 fi export POCKET_CORE_REPOS_PATH=$POCKET_CORE_REPOS_PATH