From 9b0d113d44601c59cfa5e78ff2ae08eb4f4e8a9b Mon Sep 17 00:00:00 2001 From: Connor Prussin Date: Fri, 25 Oct 2024 20:51:18 -0700 Subject: [PATCH] Fix xc-admin-frontend build --- Dockerfile.node | 3 ++- apps/api-reference/eslint.config.js | 11 +---------- apps/api-reference/src/server-config.ts | 5 +++++ apps/staking/eslint.config.js | 11 +---------- apps/staking/src/config/server.ts | 5 +++++ .../xc_admin/packages/xc_admin_frontend/Dockerfile | 3 ++- .../xc_admin/packages/xc_admin_frontend/turbo.json | 3 ++- turbo.json | 1 + 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/Dockerfile.node b/Dockerfile.node index 1ea4332d19..bcc1d6e25e 100644 --- a/Dockerfile.node +++ b/Dockerfile.node @@ -16,7 +16,8 @@ USER pyth FROM builder-base AS builder ARG package -RUN CI=true pnpm turbo build --filter $package +ENV CI true +RUN pnpm turbo build --filter $package RUN pnpm deploy --filter $package --prod /srv/$package diff --git a/apps/api-reference/eslint.config.js b/apps/api-reference/eslint.config.js index c18d44bd89..36c71dc889 100644 --- a/apps/api-reference/eslint.config.js +++ b/apps/api-reference/eslint.config.js @@ -6,13 +6,4 @@ const tailwindConfig = fileURLToPath( import.meta.resolve(`./tailwind.config.ts`), ); -export default [ - ...nextjs, - ...tailwind(tailwindConfig), - ...storybook, - { - rules: { - "turbo/no-undeclared-env-vars": "off", - }, - }, -]; +export default [...nextjs, ...tailwind(tailwindConfig), ...storybook]; diff --git a/apps/api-reference/src/server-config.ts b/apps/api-reference/src/server-config.ts index d0e7423c9c..7343b3f56a 100644 --- a/apps/api-reference/src/server-config.ts +++ b/apps/api-reference/src/server-config.ts @@ -2,6 +2,11 @@ // and load all env variables. /* eslint-disable n/no-process-env */ +// Disable the following rule because variables in this file are only loaded at +// runtime and do not influence the build outputs, thus they need not be +// declared to turbo for it to be able to cache build outputs correctly. +/* eslint-disable turbo/no-undeclared-env-vars */ + import "server-only"; /** diff --git a/apps/staking/eslint.config.js b/apps/staking/eslint.config.js index c18d44bd89..36c71dc889 100644 --- a/apps/staking/eslint.config.js +++ b/apps/staking/eslint.config.js @@ -6,13 +6,4 @@ const tailwindConfig = fileURLToPath( import.meta.resolve(`./tailwind.config.ts`), ); -export default [ - ...nextjs, - ...tailwind(tailwindConfig), - ...storybook, - { - rules: { - "turbo/no-undeclared-env-vars": "off", - }, - }, -]; +export default [...nextjs, ...tailwind(tailwindConfig), ...storybook]; diff --git a/apps/staking/src/config/server.ts b/apps/staking/src/config/server.ts index 5237da5e67..bffad26bc5 100644 --- a/apps/staking/src/config/server.ts +++ b/apps/staking/src/config/server.ts @@ -2,6 +2,11 @@ // and load all env variables. /* eslint-disable n/no-process-env */ +// Disable the following rule because variables in this file are only loaded at +// runtime and do not influence the build outputs, thus they need not be +// declared to turbo for it to be able to cache build outputs correctly. +/* eslint-disable turbo/no-undeclared-env-vars */ + import "server-only"; /** diff --git a/governance/xc_admin/packages/xc_admin_frontend/Dockerfile b/governance/xc_admin/packages/xc_admin_frontend/Dockerfile index 98017ed42a..02b71c3357 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/Dockerfile +++ b/governance/xc_admin/packages/xc_admin_frontend/Dockerfile @@ -4,7 +4,8 @@ ARG NEXT_PUBLIC_RPC_POOL_TOKEN ENV NEXT_TELEMETRY_DISABLED 1 ENV BUILD_STANDALONE true ENV NEXT_PUBLIC_RPC_POOL_TOKEN $NEXT_PUBLIC_RPC_POOL_TOKEN -RUN CI=true pnpm turbo build --filter @pythnetwork/xc-admin-frontend +ENV CI true +RUN pnpm turbo build --filter @pythnetwork/xc-admin-frontend # See https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile diff --git a/governance/xc_admin/packages/xc_admin_frontend/turbo.json b/governance/xc_admin/packages/xc_admin_frontend/turbo.json index 250a03c317..caccfbbd80 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/turbo.json +++ b/governance/xc_admin/packages/xc_admin_frontend/turbo.json @@ -4,7 +4,8 @@ "tasks": { "build": { "dependsOn": ["pull:env", "^build"], - "outputs": [".next/**", "!.next/cache/**"] + "outputs": [".next/**", "!.next/cache/**"], + "env": ["BUILD_STANDALONE"] }, "pull:env": { "outputs": [".env.local"], diff --git a/turbo.json b/turbo.json index 40baf14d64..ebd5002438 100644 --- a/turbo.json +++ b/turbo.json @@ -25,6 +25,7 @@ "cache": false }, "fix:lint": { + "dependsOn": ["^build"], "cache": false }, "test": {