From 91be333fb9df1c94885c78e8746ab183eaa21d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczyk?= Date: Fri, 1 Apr 2022 12:55:38 +0200 Subject: [PATCH] ops(dashboard-v2): prepare Dockerfile --- 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 +- 8 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 packages/dashboard-v2/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==