From a1dc50e3bb37d25e0a74188285fa6a4cfdfcbb23 Mon Sep 17 00:00:00 2001 From: Kami Date: Wed, 3 Jan 2024 04:41:27 +0330 Subject: [PATCH] add polkadot-cloud docker --- README.md | 10 +++++++--- compose.yaml | 24 ++++++++++++++++++++++++ dashboard-docker/Dockerfile | 15 +++++++++++++++ package.json | 5 +++-- 4 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 compose.yaml create mode 100644 dashboard-docker/Dockerfile diff --git a/README.md b/README.md index 8f8f017..7638e9d 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,17 @@ yarn test ## Docker -To build and run a docker container: +To build and run docker container(s): ``` -yarn docker +yarn compose ``` +Afterward, you can access various user interfaces as follows: + +- http://localhost:8000: This displays a simple decentralized application (dapp) designed for testing the Polkamask snap. + +- http://localhost:80: This presents a modified version of the Polkadot Cloud in the staking dashboard. -When using the Docker command, you can access the UI via http://localhost:8000.

diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..7e203dd --- /dev/null +++ b/compose.yaml @@ -0,0 +1,24 @@ +services: + polkamask: + build: + context: ./docker + environment: + NODE_ENV: production + ports: + - 8000:8000 + - 8080:8080 + develop: + watch: + - path: ./package.json + action: rebuild + - path: ./ + target: /usr/src/app + action: sync + + dashboard: + build: + context: ./dashboard-docker + environment: + NODE_ENV: production + ports: + - 80:80 \ No newline at end of file diff --git a/dashboard-docker/Dockerfile b/dashboard-docker/Dockerfile new file mode 100644 index 0000000..eca38b9 --- /dev/null +++ b/dashboard-docker/Dockerfile @@ -0,0 +1,15 @@ +FROM node:buster as BUILDER + +WORKDIR /app + +RUN git clone https://github.com/Nick-1979/staking-dashboard.git . + +RUN apt update && apt install -y git +RUN yarn install && yarn build + +# -------------------------------------------------- +FROM nginx + +COPY --from=BUILDER /app/build /usr/share/nginx/html + +EXPOSE 80 diff --git a/package.json b/package.json index 78aa54e..1857276 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,9 @@ "start": "yarn workspaces foreach --parallel --interlaced --verbose run start", "test": "cd packages/snap && jest test", "docker:build": "docker build -t polkagate/dapp -f docker/Dockerfile .", - "docker:run": "docker run --rm -it --name polkamask-ui -p 8000:8000 -p 8080:8080 polkagate/dapp:latest", - "docker": "yarn docker:build && yarn docker:run" + "docker:run": "docker run --rm -it --name polkamask-ui -p 80:80 -p 8000:8000 -p 8080:8080 polkagate/dapp:latest", + "docker": "yarn docker:build && yarn docker:run", + "compose": "docker compose up -d" }, "devDependencies": { "@metamask/eslint-config": "^10.0.0",