cloudflare-pages-ja.md
2.2 KB
Cloudflare Pages 導入ガイド
新規プロジェクトの作成方法
GitHub でこのプロジェクトをフォークし、dash.cloudflare.com にログインして Pages にアクセスします。
- "Create a project" をクリックする。
- "Connect to Git" を選択する。
- Cloudflare Pages を GitHub アカウントに接続します。
- フォークしたプロジェクトを選択します。
- "Begin setup" をクリックする。
- "Project name" と "Production branch" はデフォルト値を使用するか、必要に応じて変更してください。
- "Build Settings" で、"Framework presets" オプションを選択し、"Next.js" を選択します。
- node:buffer のバグのため、デフォルトの "Build command" は使用しないでください。代わりに、以下のコマンドを使用してください:
npx @cloudflare/next-on-pages --experimental-minify
- "Build output directory" はデフォルト値を使用し、変更しない。
- "Root Directory" を変更しない。
-
"Environment variables" は、">" をクリックし、"Add variable" をクリックします。そして以下の情報を入力します:
NODE_VERSION=20.1
NEXT_TELEMETRY_DISABLE=1
OPENAI_API_KEY=your_own_API_key
YARN_VERSION=1.22.19
PHP_VERSION=7.4
必要に応じて、以下の項目を入力してください:
- `CODE= Optional, access passwords, multiple passwords can be separated by commas`
- `OPENAI_ORG_ID= Optional, specify the organization ID in OpenAI`
- `HIDE_USER_API_KEY=1 Optional, do not allow users to enter their own API key`
- `DISABLE_GPT4=1 Optional, do not allow users to use GPT-4`
- "Save and Deploy" をクリックする。
- 互換性フラグを記入する必要があるため、"Cancel deployment" をクリックする。
- "Build settings" の "Functions" から "Compatibility flags" を見つける。
- "Configure Production compatibility flag" と "Configure Preview compatibility flag" の両方に "nodejs_compat "を記入する。
- "Deployments" に移動し、"Retry deployment" をクリックします。
- お楽しみください。