Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
.output
.git
.gitignore
.DS_Store
*.log
.env.local
.env.*.local
README.md
.vscode
.swc
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stage 1: 使用 bun 安装依赖和构建
FROM oven/bun:1 AS builder

WORKDIR /app

# 复制依赖文件
COPY package.json bun.lock* bun.lockb* ./

# 使用 bun 安装依赖
RUN bun install --frozen-lockfile

# 复制源代码
COPY . .

# 构建应用
RUN bun run build

# Stage 2: 使用 Node.js 运行
FROM node:22-slim AS runner

WORKDIR /app

# 从 builder 阶段复制构建产物
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./

# 设置环境变量
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000

EXPOSE 3000

# 使用 Node.js 运行 Nitro 服务
CMD ["node", ".output/server/index.mjs"]
2 changes: 1 addition & 1 deletion server/plugins/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function runMigrations() {
console.log("✅ Database migrations completed!");
} catch (error) {
console.error("❌ Failed to run migrations:", error);
process.exit(0);
process.exit(1);
} finally {
await pgClient.end();
}
Expand Down