Files
recipe_tool/Dockerfile
T
hanhan f7060b056d feat: 添加版本更新功能
- 新增 .version 文件(JSON 格式:version/release_date/changelog)
- 新增 lib/update.ts 更新逻辑(版本检查、git clone、docker compose)
- 新增 /api/update/check 版本检查 API
- 新增 /api/update/execute 执行更新 API(SSE 流式日志)
- 新增设置页「版本更新」界面(含 changelog 展示)
- Dockerfile 添加 git、docker CLI;compose 挂载 docker socket
- .env.docker 添加 ONEDEV_ACCESS_TOKEN 配置
2026-05-24 22:35:53 +08:00

63 lines
1.4 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dockerfile for Recipe Translation Tool
# Stage 1: Builder
FROM node:20-alpine AS builder
WORKDIR /app
# 国内镜像加速
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 安装 pnpm(不使用 corepack
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
# 设置国内镜像源
RUN npm config set registry https://registry.npmmirror.com && \
pnpm config set registry https://registry.npmmirror.com
# 安装依赖
RUN pnpm install --frozen-lockfile
COPY . .
# 构建项目
RUN pnpm build
# Stage 2: Runner
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# 国内镜像
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 创建用户
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
# 复制构建产物
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# 复制配置文件
COPY --from=builder /app/config.json ./
COPY --from=builder /app/.version ./
# 给 nextjs 用户授权整个目录
RUN chown -R nextjs:nodejs /app
# 安装 git(版本检查、拉取更新)和 docker CLI(构建/重启容器)
USER root
RUN apk add --no-cache git docker-cli docker-compose
RUN chown -R nextjs:nodejs /app
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]