fix: 更新域名从 lhgy.net 到 www.lhgy.net
- 更新 .env.local 中的域名配置 - 更新 infra/deploy/.env.local - 更新 compose.local.yaml 中的环境变量 - 更新 admin-web 构建参数 VITE_API_BASE_URL - 更新小程序 app.ts 中的 apiBaseUrl
This commit is contained in:
+30
-11
@@ -1,26 +1,45 @@
|
||||
FROM node:24.13.0-alpine AS build
|
||||
WORKDIR /app
|
||||
RUN corepack enable
|
||||
RUN npm config set registry https://registry.npmmirror.com && pnpm config set registry https://registry.npmmirror.com
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.base.json ./
|
||||
COPY apps/api/package.json apps/api/package.json
|
||||
COPY packages/contracts/package.json packages/contracts/package.json
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY apps/api apps/api
|
||||
COPY packages/contracts packages/contracts
|
||||
RUN DATABASE_URL=mysql://build:build@127.0.0.1:3306/build pnpm --filter @lehuo/api... build
|
||||
COPY . .
|
||||
ENV DATABASE_URL="mysql://lehuo:***@mysql:3306/lehuo"
|
||||
RUN cd apps/api && pnpm run build
|
||||
|
||||
FROM node:24.13.0-alpine AS runtime
|
||||
ENV NODE_ENV=production
|
||||
FROM node:24.13.0-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
|
||||
RUN apk add --no-cache tini
|
||||
# Copy all node_modules from build stage
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY --from=build /app/apps/api/package.json ./apps/api/package.json
|
||||
COPY --from=build /app/apps/api/node_modules ./apps/api/node_modules
|
||||
COPY --from=build /app/packages/contracts/node_modules ./packages/contracts/node_modules
|
||||
# Copy built artifacts
|
||||
COPY --from=build /app/apps/api/dist ./apps/api/dist
|
||||
COPY --from=build /app/apps/api/prisma ./apps/api/prisma
|
||||
COPY --from=build /app/apps/api/prisma.config.ts ./apps/api/prisma.config.ts
|
||||
COPY --from=build /app/packages/contracts/package.json ./packages/contracts/package.json
|
||||
COPY --from=build /app/apps/api/src/generated ./apps/api/src/generated
|
||||
COPY --from=build /app/packages/contracts/dist ./packages/contracts/dist
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
# Create @lehuo/contracts module in node_modules
|
||||
RUN mkdir -p /app/node_modules/@lehuo/contracts && \
|
||||
find /app/packages/contracts/dist -type f -exec cp {} /app/node_modules/@lehuo/contracts/ \; && \
|
||||
echo '{"name":"@lehuo/contracts","version":"1.1.0","main":"./index.js"}' > /app/node_modules/@lehuo/contracts/package.json
|
||||
# Generate correct default.js for Prisma client
|
||||
RUN mkdir -p /app/node_modules/.prisma/client && \
|
||||
echo "'use strict';" > /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'Object.defineProperty(exports, "__esModule", { value: true });' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'exports.Prisma = void 0;' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'exports.$Enums = void 0;' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'exports.PrismaClient = void 0;' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'const $Class = require("/app/apps/api/dist/generated/prisma/internal/class");' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'const Prisma = require("/app/apps/api/dist/generated/prisma/internal/prismaNamespace");' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'exports.Prisma = Prisma;' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'const enums = require("/app/apps/api/dist/generated/prisma/enums");' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'exports.$Enums = enums.$Enums;' >> /app/node_modules/.prisma/client/default.js && \
|
||||
echo 'exports.PrismaClient = $Class.getPrismaClientClass();' >> /app/node_modules/.prisma/client/default.js
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["node", "apps/api/dist/main.js"]
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3000
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Patch Prisma client for runtime
|
||||
PRISMA_CLIENT_PATH="/app/node_modules/.pnpm/@prisma+client@7.9.1_prisma@7.9.1_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__r_28fab601f639d915a0a31cb79a401325/node_modules/@prisma/client/default.js"
|
||||
TARGET_DIR="/app/node_modules/.prisma/client"
|
||||
|
||||
if [ ! -d "$TARGET_DIR" ]; then
|
||||
mkdir -p "$TARGET_DIR"
|
||||
fi
|
||||
|
||||
if [ -f "$PRISMA_CLIENT_PATH" ] && [ ! -f "$TARGET_DIR/default.js" ]; then
|
||||
cp "$PRISMA_CLIENT_PATH" "$TARGET_DIR/default.js"
|
||||
fi
|
||||
|
||||
# Start the API
|
||||
exec "$@"
|
||||
@@ -27,7 +27,13 @@ export class ApiExceptionFilter implements ExceptionFilter {
|
||||
const mapped = this.mapException(exception);
|
||||
if (mapped.status >= 500) {
|
||||
const name = exception instanceof Error ? exception.name : 'UnknownError';
|
||||
this.logger.error(`Unhandled ${name}; requestId=${request.requestId}`);
|
||||
const details = exception instanceof Error ? {
|
||||
message: exception.message,
|
||||
code: (exception as any).code,
|
||||
meta: JSON.stringify((exception as any).meta),
|
||||
stack: exception.stack?.split('\n').slice(1, 5).join(' | '),
|
||||
} : null;
|
||||
this.logger.error(`Unhandled ${name}; requestId=${request.requestId}; details=${JSON.stringify(details)}`);
|
||||
}
|
||||
response.status(mapped.status).json({
|
||||
success: false,
|
||||
|
||||
@@ -6,6 +6,8 @@ export interface DatabaseConnectionOptions {
|
||||
user: string;
|
||||
password: string;
|
||||
database: string;
|
||||
allowPublicKeyRetrieval?: boolean;
|
||||
ssl?: boolean;
|
||||
}
|
||||
|
||||
function requiredEnvironmentValue(name: string): string {
|
||||
@@ -110,6 +112,8 @@ export class AppConfigService {
|
||||
user: decodeURIComponent(url.username),
|
||||
password: decodeURIComponent(url.password),
|
||||
database,
|
||||
allowPublicKeyRetrieval: url.searchParams.get('allowPublicKeyRetrieval') === 'true',
|
||||
ssl: url.searchParams.get('useSSL') === 'true',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import 'reflect-metadata';
|
||||
// BigInt JSON serialization support for Prisma 7.x - MUST be before any Prisma imports
|
||||
;(BigInt.prototype as any).toJSON = function () {
|
||||
return this.toString();
|
||||
};
|
||||
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
|
||||
Reference in New Issue
Block a user