mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-21 09:14:42 +08:00
fix: docker runtime
This commit is contained in:
@@ -24,6 +24,8 @@ COPY . .
|
||||
|
||||
# 在构建阶段也显式设置 DOCKER_ENV,
|
||||
# 确保 Next.js 在编译时即选择 Node Runtime 而不是 Edge Runtime
|
||||
RUN find ./src -type f -name "route.ts" -print0 \
|
||||
| xargs -0 sed -i "s/export const runtime = 'edge';/export const runtime = 'nodejs';/g"
|
||||
ENV DOCKER_ENV=true
|
||||
|
||||
# 生成生产构建
|
||||
|
||||
@@ -185,7 +185,7 @@ async function getVideoDetail(
|
||||
return getDetailFromApi(apiSite, id);
|
||||
}
|
||||
|
||||
export const runtime = process.env.DOCKER_ENV === 'true' ? 'nodejs' : 'edge';
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
|
||||
@@ -43,7 +43,7 @@ async function fetchDoubanData(url: string): Promise<DoubanApiResponse> {
|
||||
}
|
||||
}
|
||||
|
||||
export const runtime = process.env.DOCKER_ENV === 'true' ? 'nodejs' : 'edge';
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const runtime = process.env.DOCKER_ENV === 'true' ? 'nodejs' : 'edge';
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
import { db } from '@/lib/db';
|
||||
import { PlayRecord } from '@/lib/db';
|
||||
|
||||
export const runtime = process.env.DOCKER_ENV === 'true' ? 'nodejs' : 'edge';
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { API_CONFIG, ApiSite, getApiSites, getCacheTime } from '@/lib/config';
|
||||
import { SearchResult } from '@/lib/types';
|
||||
import { cleanHtmlTags } from '@/lib/utils';
|
||||
|
||||
export const runtime = process.env.DOCKER_ENV === 'true' ? 'nodejs' : 'edge';
|
||||
export const runtime = 'edge';
|
||||
|
||||
// 根据环境变量决定最大搜索页数,默认 5
|
||||
const MAX_SEARCH_PAGES: number =
|
||||
|
||||
Reference in New Issue
Block a user