From 735343dbe025abb3fdf32cd90d268997878671f6 Mon Sep 17 00:00:00 2001 From: James Campbell Date: Wed, 19 Jul 2023 18:46:26 +0200 Subject: [PATCH 1/3] Add Dockerfile --- Dockerfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..49a4b54cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM node:14-alpine + +# Set the working directory inside the container +WORKDIR /app + +# Install the dependencies +RUN apk add --update --no-cache python3 make g++ && \ + apk update && apk add --no-cache git openssh-client ca-certificates && \ + git config --global url."https://".insteadOf git:// + +ENV PYTHON /usr/bin/python3 + +# Copy package.json and yarn.lock to the working directory +COPY package*.json yarn.lock ./ + +# Clean yarn cache and install dependencies +RUN yarn cache clean && yarn install + +# Copy the app's source code to the working directory +COPY . . + +# Build the React app +ENV NODE_OPTIONS=--max_old_space_size=4096 +RUN yarn build + +# Expose the container's port +EXPOSE 3000 + +# Set the command to run when the container starts +CMD ["yarn", "start"] From f293e6b1b80292eb1304f1f568f86bb39568c78c Mon Sep 17 00:00:00 2001 From: James Campbell Date: Thu, 20 Jul 2023 15:51:37 +0200 Subject: [PATCH 2/3] Switch to debian image to avoid memory issues This still requires a lot of system resources, beware! --- Dockerfile | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 49a4b54cb..7e1ce87df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,23 @@ -FROM node:14-alpine +FROM node:14-buster-slim -# Set the working directory inside the container WORKDIR /app -# Install the dependencies -RUN apk add --update --no-cache python3 make g++ && \ - apk update && apk add --no-cache git openssh-client ca-certificates && \ - git config --global url."https://".insteadOf git:// +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 ENV PYTHON /usr/bin/python3 -# Copy package.json and yarn.lock to the working directory COPY package*.json yarn.lock ./ -# Clean yarn cache and install dependencies RUN yarn cache clean && yarn install -# Copy the app's source code to the working directory COPY . . -# Build the React app -ENV NODE_OPTIONS=--max_old_space_size=4096 +ENV NODE_OPTIONS=--max_old_space_size=3072 RUN yarn build -# Expose the container's port EXPOSE 3000 -# Set the command to run when the container starts CMD ["yarn", "start"] From 3b9baec15b19dba5ff26b943e150509ae43380e9 Mon Sep 17 00:00:00 2001 From: James Campbell Date: Thu, 24 Aug 2023 11:32:16 +0200 Subject: [PATCH 3/3] docs: Update local docker development instruction in README --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/README.md b/README.md index d237a38a1..dc40f0438 100644 --- a/README.md +++ b/README.md @@ -114,3 +114,53 @@ 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 + +Update `package.json` to contain: + +```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", + "@keep-network/tbtc-v2.ts": "development", + "@threshold-network/components": "development", + "@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 build -t dashboard:latest . +docker run -p 3000:3000 -d dashboard +``` +