Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
FROM node:22-slim AS base
|
||||
RUN corepack enable && corepack prepare pnpm@10.33.0 --activate
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS deps
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
||||
COPY packages/shared/package.json packages/shared/
|
||||
COPY packages/tsconfig/package.json packages/tsconfig/
|
||||
COPY apps/server/package.json apps/server/
|
||||
RUN pnpm install --frozen-lockfile --prod=false
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_modules
|
||||
COPY --from=deps /app/apps/server/node_modules ./apps/server/node_modules
|
||||
COPY . .
|
||||
RUN pnpm --filter @ai-tycoon/shared build && \
|
||||
pnpm --filter @ai-tycoon/server typecheck
|
||||
|
||||
FROM base AS production
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_modules
|
||||
COPY --from=deps /app/apps/server/node_modules ./apps/server/node_modules
|
||||
COPY packages/shared ./packages/shared
|
||||
COPY packages/tsconfig ./packages/tsconfig
|
||||
COPY apps/server ./apps/server
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3001
|
||||
CMD ["node", "--import", "tsx", "apps/server/src/index.ts"]
|
||||
@@ -5,7 +5,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"build": "tsc && tsx src/index.ts",
|
||||
"build": "tsc",
|
||||
"start": "node --import tsx src/index.ts",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
"db:migrate": "drizzle-kit migrate",
|
||||
|
||||
@@ -10,7 +10,9 @@ const app = new Hono();
|
||||
|
||||
app.use('*', logger());
|
||||
app.use('*', cors({
|
||||
origin: ['http://localhost:5173', 'http://localhost:5174', 'http://localhost:5175', 'http://localhost:5178'],
|
||||
origin: process.env.CORS_ORIGIN
|
||||
? process.env.CORS_ORIGIN.split(',')
|
||||
: ['http://localhost:5173', 'http://localhost:5174', 'http://localhost:5175', 'http://localhost:5178'],
|
||||
allowMethods: ['GET', 'POST', 'PUT', 'DELETE'],
|
||||
allowHeaders: ['Content-Type', 'Authorization'],
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user