From 4c177bfe3c31bbd9d4fe6db3f1d0325cebbbb3f9 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Wed, 4 Sep 2024 06:17:31 +0800 Subject: [PATCH] [fix] Building errors of Development & Production environments --- Dockerfile | 2 +- next.config.mjs | 5 +++-- pages/api/GitHub/core.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 15f4e07..a2dcf1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ WORKDIR /app FROM base AS build RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile -RUN pnpm build +RUN CI=true pnpm build FROM base COPY --from=build /app/.next/standalone ./ diff --git a/next.config.mjs b/next.config.mjs index 712c581..0a3da5d 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -11,7 +11,8 @@ import RemarkGfm from 'remark-gfm'; import RemarkMdxFrontMatter from 'remark-mdx-frontmatter'; import WP from 'webpack'; -const { NODE_ENV, SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT } = process.env; +const { NODE_ENV, CI, SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT } = + process.env; const isDev = NODE_ENV === 'development'; const withMDX = NextMDX({ @@ -86,7 +87,7 @@ const rewrites = async () => ({ const nextConfig = withPWA( withLess( withMDX({ - output: 'standalone', + output: CI ? 'standalone' : undefined, pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], transpilePackages: ['@sentry/browser'], webpack, diff --git a/pages/api/GitHub/core.ts b/pages/api/GitHub/core.ts index b09d453..b2b1c69 100644 --- a/pages/api/GitHub/core.ts +++ b/pages/api/GitHub/core.ts @@ -22,7 +22,7 @@ export const proxyGithub = (dataFilter?: (path: string, data: T) => T) => response.send(dataFilter?.(path, data as T) || data); }); -const client_id = process.env.NEXT_PUBLIC_GITHUB_OAUTH_CLIENT_ID!, +const client_id = process.env.GITHUB_OAUTH_CLIENT_ID!, client_secret = process.env.GITHUB_OAUTH_CLIENT_SECRET!, { VERCEL } = process.env;