mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-08 01:08:43 +08:00
5ccdcc1cd4
* chore: bump pro submodule for hydration stability (#6808) * sandbox-sync-agent * refactor: host pro as submodule * chore: checkpoint host pro restructure * refactor workspace test layout and startup init * chore: update next turbopack setup * chore: snapshot current work before actions fix * chore: update pro submodule * chore: point pro submodule url to upstream https * fix: Dockerfile * chore: update pro submodule * ci: support private pro submodule token and skip fork jobs * fix(ci): build sdk workspace deps before code-sandbox bundle * fix(app): exclude vitest configs from production typecheck * fix(app-image): build sdk packages before next build * fix(ci): align dockerfiles with workspace sdk build flow * chore(docker): upgrade node20 docker images to node24 * fix(ci): read admin coverage output path in pro test workflow * fix(app-image): include next-i18next config and locale assets * chore: update pro submodule * chore: do not specify branch for submodule * chore: remove most ts-nocheck sign * chore: update pro submodule * chore: remove sandbox-agent-sync package * chore: do not modify "pushData" file logic * fix: health check * chore: restore dev axios proxy state * fix: test-fastgpt report workflow * fix: use valid vitest coverage action inputs * update shell (#6830) * .codex (#6832) * fix: home chat file uploads (#6838) * chore: update actions workflow yamls * chore: update turbo.json * fix: split admin preview image workflows * fix: allow home chat file uploads * chore: add skip file type check env (#6839) * chore: update actions workflow yamls (#6835) * chore: update actions workflow yamls * fix: allow pro workflows on fork pull requests * chore: update turbo.json * fix: split admin preview image workflows * chore: bump pro submodule for admin typecheck * chore: update pro submodule * chore: bump pro submodule for turbo ignore * chore: update pro submodule for file download api --------- Co-authored-by: Archer <545436317@qq.com>
64 lines
2.0 KiB
Docker
64 lines
2.0 KiB
Docker
# --------- Build Stage -----------
|
||
FROM oven/bun:1-alpine AS builder
|
||
WORKDIR /app
|
||
|
||
ARG proxy
|
||
|
||
# 安装 pnpm
|
||
RUN apk add --no-cache nodejs npm && npm install -g pnpm@10.33.2
|
||
|
||
# 复制 workspace 配置和依赖包
|
||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
||
COPY packages/global ./packages/global
|
||
COPY packages/service ./packages/service
|
||
COPY sdk ./sdk
|
||
COPY projects/code-sandbox/ ./projects/code-sandbox/
|
||
|
||
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||
RUN apk add --no-cache curl ca-certificates && update-ca-certificates
|
||
|
||
# 安装所有依赖(包括 devDependencies 用于编译)
|
||
RUN if [ -z "$proxy" ]; then \
|
||
pnpm install --frozen-lockfile --ignore-scripts; \
|
||
else \
|
||
pnpm install --frozen-lockfile --ignore-scripts --registry=https://registry.npmmirror.com; \
|
||
fi
|
||
|
||
# 先构建 SDK workspace 包,确保 dist 入口可被 bun build 解析
|
||
RUN pnpm --filter @fastgpt-sdk/logger --filter @fastgpt-sdk/otel --filter @fastgpt-sdk/storage build
|
||
|
||
# 编译主入口文件
|
||
RUN cd /app/projects/code-sandbox && pnpm build
|
||
|
||
# ===== Runner Stage =====
|
||
FROM oven/bun:1-alpine AS runner
|
||
WORKDIR /app
|
||
|
||
ARG proxy
|
||
|
||
# 复制编译产物(包含 worker 文件,不需要 node_modules)
|
||
COPY --from=builder /app/projects/code-sandbox/dist /app/code-sandbox
|
||
|
||
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||
|
||
# 安装 Python、依赖包及工具
|
||
RUN apk add --no-cache python3 py3-pip libffi util-linux && \
|
||
apk add --no-cache --virtual .build-deps gcc g++ musl-dev python3-dev libffi-dev
|
||
COPY projects/code-sandbox/requirements.txt /tmp/requirements.txt
|
||
RUN pip3 install --no-cache-dir --break-system-packages -r /tmp/requirements.txt && \
|
||
rm /tmp/requirements.txt && \
|
||
apk del .build-deps
|
||
|
||
|
||
# 创建非 root 用户运行沙箱
|
||
RUN addgroup -S sandbox && adduser -S sandbox -G sandbox && \
|
||
chown -R sandbox:sandbox /app
|
||
USER sandbox
|
||
|
||
ENV NODE_ENV=production
|
||
ENV SANDBOX_PORT=3000
|
||
|
||
EXPOSE 3000
|
||
|
||
CMD ["bun", "/app/code-sandbox/index.js"]
|