From 688dbbd52fcb33259fa740bfa9b45abf06261355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczyk?= Date: Thu, 7 Apr 2022 12:59:20 +0200 Subject: [PATCH 01/11] ops(dashboard-v2): prepare Dockerfile (#1971) * ops(dashboard-v2): prepare Dockerfile * ops(dashboard-v2): lint dashboard-v2/Dockerfile --- .github/workflows/lint-dockerfiles.yml | 1 + docker-compose.accounts.yml | 22 +++++++++++++++++++ packages/dashboard-v2/Dockerfile | 14 ++++++++++++ packages/dashboard-v2/gatsby-config.js | 2 +- .../src/hooks/useUpgradeRedirect.js | 1 - .../src/layouts/DashboardLayout.js | 2 +- .../src/layouts/UserSettingsLayout.js | 2 +- .../dashboard-v2/src/pages/auth/signup.js | 2 +- packages/dashboard-v2/yarn.lock | 2 +- 9 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 packages/dashboard-v2/Dockerfile diff --git a/.github/workflows/lint-dockerfiles.yml b/.github/workflows/lint-dockerfiles.yml index 1eea156c..467dc117 100644 --- a/.github/workflows/lint-dockerfiles.yml +++ b/.github/workflows/lint-dockerfiles.yml @@ -16,6 +16,7 @@ jobs: - docker/nginx/Dockerfile - docker/sia/Dockerfile - packages/dashboard/Dockerfile + - packages/dashboard-v2/Dockerfile - packages/dnslink-api/Dockerfile - packages/handshake-api/Dockerfile - packages/health-check/Dockerfile diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 5d9d345c..73953a57 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -75,3 +75,25 @@ services: - 3000 depends_on: - mongo + + dashboard-v2: + build: + context: ./packages/dashboard-v2 + dockerfile: Dockerfile + container_name: dashboard-v2 + restart: unless-stopped + logging: *default-logging + env_file: + - .env + environment: + - GATSBY_PORTAL_DOMAIN=${PORTAL_DOMAIN} + volumes: + - ./docker/data/dashboard-v2/.cache:/usr/app/.cache + - ./docker/data/dashboard-v2/public:/usr/app/public + networks: + shared: + ipv4_address: 10.10.10.90 + expose: + - 9000 + depends_on: + - mongo diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile new file mode 100644 index 00000000..70790cfa --- /dev/null +++ b/packages/dashboard-v2/Dockerfile @@ -0,0 +1,14 @@ +FROM node:16.14.2-alpine + +WORKDIR /usr/app + +COPY package.json yarn.lock ./ + +RUN yarn --frozen-lockfile + +COPY static ./static +COPY src ./src +COPY gatsby*.js ./ +COPY postcss.config.js tailwind.config.js ./ + +CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard-v2/gatsby-config.js b/packages/dashboard-v2/gatsby-config.js index c6096a98..2280f99b 100644 --- a/packages/dashboard-v2/gatsby-config.js +++ b/packages/dashboard-v2/gatsby-config.js @@ -18,7 +18,7 @@ module.exports = { resolve: "gatsby-source-filesystem", options: { name: "images", - path: "./src/images/", + path: "./static/images/", }, __key: "images", }, diff --git a/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js b/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js index 5529c152..54efd956 100644 --- a/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js +++ b/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js @@ -17,7 +17,6 @@ export default function useUpgradeRedirect() { if (isDataLoaded) { if (settings.isSubscriptionRequired && !hasPaidSubscription) { - console.log("redirecting", user, settings); navigate("/upgrade"); } else { setVerifyingSubscription(false); diff --git a/packages/dashboard-v2/src/layouts/DashboardLayout.js b/packages/dashboard-v2/src/layouts/DashboardLayout.js index 76af9218..fe4c5385 100644 --- a/packages/dashboard-v2/src/layouts/DashboardLayout.js +++ b/packages/dashboard-v2/src/layouts/DashboardLayout.js @@ -5,7 +5,7 @@ import { SWRConfig } from "swr"; import { authenticatedOnly } from "../lib/swrConfig"; import { PageContainer } from "../components/PageContainer"; -import { NavBar } from "../components/Navbar"; +import { NavBar } from "../components/NavBar"; import { Footer } from "../components/Footer"; import { UserProvider, useUser } from "../contexts/user"; import { FullScreenLoadingIndicator } from "../components/LoadingIndicator"; diff --git a/packages/dashboard-v2/src/layouts/UserSettingsLayout.js b/packages/dashboard-v2/src/layouts/UserSettingsLayout.js index 2ca769bc..d7b9b7d4 100644 --- a/packages/dashboard-v2/src/layouts/UserSettingsLayout.js +++ b/packages/dashboard-v2/src/layouts/UserSettingsLayout.js @@ -6,7 +6,7 @@ import { SWRConfig } from "swr"; import { authenticatedOnly } from "../lib/swrConfig"; import { PageContainer } from "../components/PageContainer"; -import { NavBar } from "../components/Navbar"; +import { NavBar } from "../components/NavBar"; import { Footer } from "../components/Footer"; import { UserProvider, useUser } from "../contexts/user"; import { ContainerLoadingIndicator } from "../components/LoadingIndicator"; diff --git a/packages/dashboard-v2/src/pages/auth/signup.js b/packages/dashboard-v2/src/pages/auth/signup.js index b6f0e0ac..4da915f1 100644 --- a/packages/dashboard-v2/src/pages/auth/signup.js +++ b/packages/dashboard-v2/src/pages/auth/signup.js @@ -15,7 +15,7 @@ const FreePortalHeader = () => { const { plans } = usePlans(); const freePlan = plans.find(({ price }) => price === 0); - const freeStorage = freePlan ? bytes(freePlan.limits?.storageLimit, { binary: true }) : null; + const freeStorage = freePlan?.limits ? bytes(freePlan.limits?.storageLimit, { binary: true }) : null; return (
diff --git a/packages/dashboard-v2/yarn.lock b/packages/dashboard-v2/yarn.lock index 30d4e8e8..c3de4379 100644 --- a/packages/dashboard-v2/yarn.lock +++ b/packages/dashboard-v2/yarn.lock @@ -14090,7 +14090,7 @@ sjcl@^1.0.8: resolved "https://registry.yarnpkg.com/sjcl/-/sjcl-1.0.8.tgz#f2ec8d7dc1f0f21b069b8914a41a8f236b0e252a" integrity sha512-LzIjEQ0S0DpIgnxMEayM1rq9aGwGRG4OnZhCdjx7glTaJtf4zRfpg87ImfjSJjoW9vKpagd82McDOwbRT5kQKQ== -skynet-js@^4.0.27-beta: +skynet-js@4.0.27-beta: version "4.0.27-beta" resolved "https://registry.yarnpkg.com/skynet-js/-/skynet-js-4.0.27-beta.tgz#4257bffda8757830656e0beb89d0d2e44da17e2f" integrity sha512-JV+QE/2l2YwVN1jQHVMFXgggwtBrPAnuyXySbLgafEJAde5dUwSEr5YRMV+3LvEgYkGhxSb74pyq0u0wrF2sUg== From e7183f471bd2dfd9a7ce7dddaded074d9cecbe64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Wypch=C5=82o?= Date: Thu, 7 Apr 2022 13:52:23 +0200 Subject: [PATCH 02/11] remove max body size constraint on tus endpoint (#1976) --- docker/nginx/conf.d/server/server.api | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/nginx/conf.d/server/server.api b/docker/nginx/conf.d/server/server.api index f681cca8..5bd1aa61 100644 --- a/docker/nginx/conf.d/server/server.api +++ b/docker/nginx/conf.d/server/server.api @@ -241,8 +241,8 @@ location /skynet/tus { limit_conn upload_conn 5; limit_conn upload_conn_rl 1; - # TUS chunks size is 40M + leaving 10M of breathing room - client_max_body_size 50M; + # Do not limit body size in nginx, skyd will reject early on too large upload + client_max_body_size 0; # Those timeouts need to be elevated since skyd can stall reading # data for a while when overloaded which would terminate connection From d577f332b68170ac82689fb8a980e2ef4db90eac Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:12:24 +0200 Subject: [PATCH 03/11] use website docker image --- docker-compose.yml | 8 +++++--- packages/website/Dockerfile | 16 +++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2879b8b6..973d5a97 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,9 +82,11 @@ services: - website website: - build: - context: ./packages/website - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/website/Dockerfile + image: skynetlabs/website container_name: website restart: unless-stopped logging: *default-logging diff --git a/packages/website/Dockerfile b/packages/website/Dockerfile index 3a9fa9a1..9477a4f6 100644 --- a/packages/website/Dockerfile +++ b/packages/website/Dockerfile @@ -4,16 +4,22 @@ RUN apk add --no-cache autoconf=2.71-r0 automake=1.16.4-r1 build-base=0.5-r2 lib WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/website/package.json packages/website/yarn.lock ./ ENV GATSBY_TELEMETRY_DISABLED 1 ENV CYPRESS_INSTALL_BINARY 0 RUN yarn --frozen-lockfile -COPY data ./data -COPY src ./src -COPY static ./static -COPY gatsby-browser.js gatsby-config.js gatsby-node.js gatsby-ssr.js postcss.config.js tailwind.config.js ./ +COPY packages/website/data ./data +COPY packages/website/src ./src +COPY packages/website/static ./static +COPY packages/website/gatsby-browser.js \ + packages/website/gatsby-config.js \ + packages/website/gatsby-node.js \ + packages/website/gatsby-ssr.js \ + packages/website/postcss.config.js \ + packages/website/tailwind.config.js \ + ./ RUN yarn build From 40b8390c193e519e4b564c3dea75d17ab1e94fec Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:38:19 +0200 Subject: [PATCH 04/11] use handshake-api docker image --- docker-compose.yml | 8 +++++--- packages/handshake-api/Dockerfile | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 973d5a97..1ab54e0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -120,9 +120,11 @@ services: - 12037 handshake-api: - build: - context: ./packages/handshake-api - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/handshake-api/Dockerfile + image: skynetlabs/handshake-api container_name: handshake-api restart: unless-stopped logging: *default-logging diff --git a/packages/handshake-api/Dockerfile b/packages/handshake-api/Dockerfile index 92f30b36..2f6930b0 100644 --- a/packages/handshake-api/Dockerfile +++ b/packages/handshake-api/Dockerfile @@ -2,11 +2,11 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/handshake-api/package.json packages/handshake-api/yarn.lock ./ RUN yarn --frozen-lockfile -COPY src/* src/ +COPY packages/handshake-api/src/* src/ ENV HSD_NETWORK="main" ENV HSD_HOST="0.0.0.0" From 1d50d51f2987526256033fa73dfaa45b3be259f6 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:39:53 +0200 Subject: [PATCH 05/11] use dnslink-api docker image --- docker-compose.yml | 8 +++++--- packages/dnslink-api/Dockerfile | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1ab54e0f..153d6f16 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -144,9 +144,11 @@ services: - handshake dnslink-api: - build: - context: ./packages/dnslink-api - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dnslink-api/Dockerfile + image: skynetlabs/dnslink-api container_name: dnslink-api restart: unless-stopped logging: *default-logging diff --git a/packages/dnslink-api/Dockerfile b/packages/dnslink-api/Dockerfile index be1f9452..fd477e87 100644 --- a/packages/dnslink-api/Dockerfile +++ b/packages/dnslink-api/Dockerfile @@ -2,11 +2,11 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dnslink-api/package.json packages/dnslink-api/yarn.lock ./ RUN yarn --frozen-lockfile -COPY src/* src/ +COPY packages/dnslink-api/src/* src/ EXPOSE 3100 CMD ["node", "src/index.js"] From 73dad081eaf9a76b3c1de248fd2b3fdc8ef54021 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:41:18 +0200 Subject: [PATCH 06/11] use health-check docker image --- docker-compose.yml | 8 +++++--- packages/health-check/Dockerfile | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 153d6f16..5838f136 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -159,9 +159,11 @@ services: - 3100 health-check: - build: - context: ./packages/health-check - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/health-check/Dockerfile + image: skynetlabs/health-check container_name: health-check restart: unless-stopped logging: *default-logging diff --git a/packages/health-check/Dockerfile b/packages/health-check/Dockerfile index e9d15a77..cc4cb793 100644 --- a/packages/health-check/Dockerfile +++ b/packages/health-check/Dockerfile @@ -11,13 +11,13 @@ ENV PATH="/usr/app/bin:${PATH}" RUN echo '*/5 * * * * source /etc/environment ; /usr/app/bin/cli run critical >> /proc/1/fd/1' >> /etc/crontabs/root && \ echo '0 * * * * source /etc/environment ; /usr/app/bin/cli run extended >> /proc/1/fd/1' >> /etc/crontabs/root -COPY package.json yarn.lock ./ +COPY packages/health-check/package.json packages/health-check/yarn.lock ./ RUN yarn --frozen-lockfile -COPY src src -COPY cli cli -COPY bin bin +COPY packages/health-check/src src +COPY packages/health-check/cli cli +COPY packages/health-check/bin bin EXPOSE 3100 ENV NODE_ENV production From 7963c2cb63ee07817362e685f8134bf45cdffe02 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:47:49 +0200 Subject: [PATCH 07/11] use dashboard docker images --- docker-compose.accounts.yml | 16 ++++++++++------ packages/dashboard-v2/Dockerfile | 12 +++++++----- packages/dashboard/Dockerfile | 13 ++++++++----- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 73953a57..9fa4722d 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -55,9 +55,11 @@ services: - mongo dashboard: - build: - context: ./packages/dashboard - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dashboard/Dockerfile + image: skynetlabs/dashboard container_name: dashboard restart: unless-stopped logging: *default-logging @@ -77,9 +79,11 @@ services: - mongo dashboard-v2: - build: - context: ./packages/dashboard-v2 - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dashboard-v2/Dockerfile + image: skynetlabs/dashboard-v2 container_name: dashboard-v2 restart: unless-stopped logging: *default-logging diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 70790cfa..eaa4d073 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -2,13 +2,15 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dashboard-v2/package.json packages/dashboard-v2/yarn.lock ./ RUN yarn --frozen-lockfile -COPY static ./static -COPY src ./src -COPY gatsby*.js ./ -COPY postcss.config.js tailwind.config.js ./ +COPY packages/dashboard/static ./static +COPY packages/dashboard/src ./src +COPY packages/dashboard/gatsby*.js ./ +COPY packages/dashboard/postcss.config.js \ + packages/dashboard/tailwind.config.js \ + ./ CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 39707664..5d8d8391 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -2,14 +2,17 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dashboard/package.json packages/dashboard/yarn.lock ./ ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn --frozen-lockfile -COPY public ./public -COPY src ./src -COPY styles ./styles -COPY .eslintrc.json postcss.config.js tailwind.config.js ./ +COPY packages/dashboard/public ./public +COPY packages/dashboard/src ./src +COPY packages/dashboard/styles ./styles +COPY packages/dashboard/.eslintrc.json \ + packages/dashboard/postcss.config.js \ + packages/dashboard/tailwind.config.js \ + ./ CMD ["sh", "-c", "env | grep -E 'NEXT_PUBLIC|STRIPE|ACCOUNTS' > .env.local && yarn build && yarn start"] From e8d68a0fa06db2f2f3959189c58c9b65e66108ae Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:51:12 +0200 Subject: [PATCH 08/11] clean up docker images --- packages/dashboard-v2/Dockerfile | 8 +++++--- packages/dashboard/Dockerfile | 4 +++- packages/dnslink-api/Dockerfile | 4 +++- packages/handshake-api/Dockerfile | 4 +++- packages/health-check/Dockerfile | 4 +++- packages/website/Dockerfile | 9 ++++----- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index eaa4d073..4655767b 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -2,14 +2,16 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard-v2/package.json packages/dashboard-v2/yarn.lock ./ +COPY packages/dashboard-v2/package.json \ + packages/dashboard-v2/yarn.lock \ + ./ RUN yarn --frozen-lockfile COPY packages/dashboard/static ./static COPY packages/dashboard/src ./src -COPY packages/dashboard/gatsby*.js ./ -COPY packages/dashboard/postcss.config.js \ +COPY packages/dashboard/gatsby*.js \ + packages/dashboard/postcss.config.js \ packages/dashboard/tailwind.config.js \ ./ diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 5d8d8391..25f584b3 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -2,7 +2,9 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard/package.json packages/dashboard/yarn.lock ./ +COPY packages/dashboard/package.json \ + packages/dashboard/yarn.lock \ + ./ ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn --frozen-lockfile diff --git a/packages/dnslink-api/Dockerfile b/packages/dnslink-api/Dockerfile index fd477e87..9ded8cbf 100644 --- a/packages/dnslink-api/Dockerfile +++ b/packages/dnslink-api/Dockerfile @@ -2,7 +2,9 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dnslink-api/package.json packages/dnslink-api/yarn.lock ./ +COPY packages/dnslink-api/package.json \ + packages/dnslink-api/yarn.lock \ + ./ RUN yarn --frozen-lockfile diff --git a/packages/handshake-api/Dockerfile b/packages/handshake-api/Dockerfile index 2f6930b0..211044c1 100644 --- a/packages/handshake-api/Dockerfile +++ b/packages/handshake-api/Dockerfile @@ -2,7 +2,9 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/handshake-api/package.json packages/handshake-api/yarn.lock ./ +COPY packages/handshake-api/package.json \ + packages/handshake-api/yarn.lock \ + ./ RUN yarn --frozen-lockfile diff --git a/packages/health-check/Dockerfile b/packages/health-check/Dockerfile index cc4cb793..15ef0086 100644 --- a/packages/health-check/Dockerfile +++ b/packages/health-check/Dockerfile @@ -11,7 +11,9 @@ ENV PATH="/usr/app/bin:${PATH}" RUN echo '*/5 * * * * source /etc/environment ; /usr/app/bin/cli run critical >> /proc/1/fd/1' >> /etc/crontabs/root && \ echo '0 * * * * source /etc/environment ; /usr/app/bin/cli run extended >> /proc/1/fd/1' >> /etc/crontabs/root -COPY packages/health-check/package.json packages/health-check/yarn.lock ./ +COPY packages/health-check/package.json \ + packages/health-check/yarn.lock \ + ./ RUN yarn --frozen-lockfile diff --git a/packages/website/Dockerfile b/packages/website/Dockerfile index 9477a4f6..dad0e393 100644 --- a/packages/website/Dockerfile +++ b/packages/website/Dockerfile @@ -4,7 +4,9 @@ RUN apk add --no-cache autoconf=2.71-r0 automake=1.16.4-r1 build-base=0.5-r2 lib WORKDIR /usr/app -COPY packages/website/package.json packages/website/yarn.lock ./ +COPY packages/website/package.json \ + packages/website/yarn.lock \ + ./ ENV GATSBY_TELEMETRY_DISABLED 1 ENV CYPRESS_INSTALL_BINARY 0 @@ -13,10 +15,7 @@ RUN yarn --frozen-lockfile COPY packages/website/data ./data COPY packages/website/src ./src COPY packages/website/static ./static -COPY packages/website/gatsby-browser.js \ - packages/website/gatsby-config.js \ - packages/website/gatsby-node.js \ - packages/website/gatsby-ssr.js \ +COPY packages/website/gatsby-*.js \ packages/website/postcss.config.js \ packages/website/tailwind.config.js \ ./ From 7707a34564102f430bc4548b56dd63cdfdb43c60 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:55:54 +0200 Subject: [PATCH 09/11] fix dashboard-v2 dockerfile --- packages/dashboard-v2/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 4655767b..4c834e0c 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -8,11 +8,11 @@ COPY packages/dashboard-v2/package.json \ RUN yarn --frozen-lockfile -COPY packages/dashboard/static ./static -COPY packages/dashboard/src ./src -COPY packages/dashboard/gatsby*.js \ - packages/dashboard/postcss.config.js \ - packages/dashboard/tailwind.config.js \ +COPY packages/dashboard-v2/static ./static +COPY packages/dashboard-v2/src ./src +COPY packages/dashboard-v2/gatsby*.js \ + packages/dashboard-v2/postcss.config.js \ + packages/dashboard-v2/tailwind.config.js \ ./ CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] From 8bdb64e745818207da0ab6fc32a4185c2358e2aa Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:57:53 +0200 Subject: [PATCH 10/11] build gatsby as a part of docker build process --- packages/dashboard-v2/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 4c834e0c..9fb4c604 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -15,4 +15,8 @@ COPY packages/dashboard-v2/gatsby*.js \ packages/dashboard-v2/tailwind.config.js \ ./ -CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] +RUN yarn build + +EXPOSE 9000 + +CMD ["sh", "-c", "yarn serve --host 0.0.0.0 -p 9000"] From 66cdd712f09d14be05784d4c110943d1b436a2eb Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 15:16:25 +0200 Subject: [PATCH 11/11] revert using image for dashboard --- docker-compose.accounts.yml | 16 ++++++---------- packages/dashboard-v2/Dockerfile | 20 ++++++-------------- packages/dashboard/Dockerfile | 15 +++++---------- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 9fa4722d..73953a57 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -55,11 +55,9 @@ services: - mongo dashboard: - # uncomment "build" and comment out "image" to build from sources - # build: - # context: https://github.com/SkynetLabs/skynet-webportal.git#master - # dockerfile: ./packages/dashboard/Dockerfile - image: skynetlabs/dashboard + build: + context: ./packages/dashboard + dockerfile: Dockerfile container_name: dashboard restart: unless-stopped logging: *default-logging @@ -79,11 +77,9 @@ services: - mongo dashboard-v2: - # uncomment "build" and comment out "image" to build from sources - # build: - # context: https://github.com/SkynetLabs/skynet-webportal.git#master - # dockerfile: ./packages/dashboard-v2/Dockerfile - image: skynetlabs/dashboard-v2 + build: + context: ./packages/dashboard-v2 + dockerfile: Dockerfile container_name: dashboard-v2 restart: unless-stopped logging: *default-logging diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 9fb4c604..70790cfa 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -2,21 +2,13 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard-v2/package.json \ - packages/dashboard-v2/yarn.lock \ - ./ +COPY package.json yarn.lock ./ RUN yarn --frozen-lockfile -COPY packages/dashboard-v2/static ./static -COPY packages/dashboard-v2/src ./src -COPY packages/dashboard-v2/gatsby*.js \ - packages/dashboard-v2/postcss.config.js \ - packages/dashboard-v2/tailwind.config.js \ - ./ +COPY static ./static +COPY src ./src +COPY gatsby*.js ./ +COPY postcss.config.js tailwind.config.js ./ -RUN yarn build - -EXPOSE 9000 - -CMD ["sh", "-c", "yarn serve --host 0.0.0.0 -p 9000"] +CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 25f584b3..39707664 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -2,19 +2,14 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard/package.json \ - packages/dashboard/yarn.lock \ - ./ +COPY package.json yarn.lock ./ ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn --frozen-lockfile -COPY packages/dashboard/public ./public -COPY packages/dashboard/src ./src -COPY packages/dashboard/styles ./styles -COPY packages/dashboard/.eslintrc.json \ - packages/dashboard/postcss.config.js \ - packages/dashboard/tailwind.config.js \ - ./ +COPY public ./public +COPY src ./src +COPY styles ./styles +COPY .eslintrc.json postcss.config.js tailwind.config.js ./ CMD ["sh", "-c", "env | grep -E 'NEXT_PUBLIC|STRIPE|ACCOUNTS' > .env.local && yarn build && yarn start"]