init
This commit is contained in:
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
# Dockerfile
|
||||
FROM oven/bun:1 AS base
|
||||
WORKDIR /app
|
||||
|
||||
# 安装依赖(缓存层)
|
||||
COPY package.json bun.lockb* ./
|
||||
RUN bun install --production
|
||||
|
||||
# 复制源码
|
||||
COPY . .
|
||||
|
||||
# 构建(Bun 支持直接运行 TS,无需编译)
|
||||
# 如果你希望预编译,可加 RUN bun build ...
|
||||
|
||||
# 创建非 root 用户(安全最佳实践)
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S nextjs -u 1001 -G nodejs
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# 启动命令
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
Reference in New Issue
Block a user