diff --git a/.env b/.env.example similarity index 100% rename from .env rename to .env.example diff --git a/.gitignore b/.gitignore index 44bc97aeb..344f01f84 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ cypress/plugins # Yarn node_modules/ yarn-error.log +.env +.cosine diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000..b90df6383 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,22 @@ +# Use the specified image +FROM node:14-buster-slim + +# Set the working directory +WORKDIR /app + +# Install dependencies +RUN apt-get update && apt-get install -y python3 make g++ git openssh-client ca-certificates && \ + git config --global url."https://".insteadOf git:// && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get clean + +# Set the environment variables +ENV PYTHON=/usr/bin/python3 +ENV NODE_OPTIONS=--max_old_space_size=3072 + +# Copy package files and install node modules +COPY package*.json yarn.lock ./ +RUN yarn install + +# Expose port 3000 +EXPOSE 3000 diff --git a/README.md b/README.md index d8ca59b2c..ba93b4035 100644 --- a/README.md +++ b/README.md @@ -126,3 +126,48 @@ The following procedure allows to deploy T token dashboard to production: approval of someone else from the development team. 5. Once the release action is approved, the new version is automatically deployed to `dashboard.threshold.network`. + +## Local Development + +Replace the following dependencies on `package.json`: + +```json + "@keep-network/coverage-pools": "goerli", + "@keep-network/ecdsa": "goerli", + "@keep-network/keep-core": "1.8.1-goerli.0", + "@keep-network/keep-ecdsa": "goerli", + "@keep-network/random-beacon": "goerli", + "@keep-network/tbtc": "goerli", + "@keep-network/tbtc-v2": "goerli", + "@threshold-network/solidity-contracts": "goerli", +``` + +Update `.env` to contain: + +``` +REACT_APP_SUPPORTED_CHAIN_ID=5 +REACT_APP_ETH_HOSTNAME_HTTP=https://goerli.infura.io/v3/ +REACT_APP_ETH_HOSTNAME_WS=wss://goerli.infura.io/v3/ +REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS + +REACT_APP_FEATURE_FLAG_TBTC_V2=true +REACT_APP_FEATURE_FLAG_TBTC_V2_REDEMPTION=true +REACT_APP_FEATURE_FLAG_MULTI_APP_STAKING=true +REACT_APP_FEATURE_FLAG_FEEDBACK_MODULE=false +REACT_APP_FEATURE_FLAG_POSTHOG=false +REACT_APP_FEATURE_FLAG_SENTRY=$SENTRY_SUPPORT +REACT_APP_SENTRY_DSN=$SENTRY_DSN + +REACT_APP_ELECTRUM_PROTOCOL=wss +REACT_APP_ELECTRUM_HOST=electrumx-server.test.tbtc.network +REACT_APP_ELECTRUM_PORT=8443 +REACT_APP_MOCK_BITCOIN_CLIENT=false + +REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_PROJECT_ID +``` + +Then build the docker container and run the dashboard: + +```bash +docker-compose up --build +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..47ef982a8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.8" + +services: + threshold-dashboard: + image: node:14-buster-slim + container_name: threshold-dashboard + working_dir: /app + environment: + - PYTHON=/usr/bin/python3 + - NODE_OPTIONS=--max_old_space_size=3072 + ports: + - "3000:3000" + volumes: + - .:/app # Bind mount the current directory to /app in the container + - /app/node_modules # This will prevent node_modules from being overwritten by the local volume + command: bash -c "yarn format:fix && yarn start" + build: + context: . + dockerfile: Dockerfile.dev