You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

29 lines
759 B

# 使用官方 Bun 运行时的轻量级镜像
FROM oven/bun:alpine AS base
WORKDIR /app
# 仅复制生产依赖相关文件
COPY package.json bun.lockb knexfile.mjs .npmrc ./
# 安装依赖(生产环境)
RUN bun install --production
# 复制应用代码和静态资源
COPY src ./src
COPY public ./public
COPY entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
# 如需数据库文件(如 SQLite),可挂载到宿主机
VOLUME /app/database
# 启动命令(如有端口需求可暴露端口)
EXPOSE 3000
# 健康检查:每30秒检查一次服务端口,3次失败则容器为unhealthy
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --spider -q http://localhost:3000/ || exit 1
ENTRYPOINT ["./entrypoint.sh"]