-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (45 loc) · 1.77 KB
/
Dockerfile
File metadata and controls
58 lines (45 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# ============================================================
# ResearchOS Docker - 单容器部署(Nginx + API + Worker)
# @author Bamzc
# ============================================================
# Stage 1: 前端构建
FROM node:20-slim AS frontend
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY frontend/ ./
RUN npm run build
# Stage 2: Python 后端 + Nginx + Supervisor
FROM python:3.11-slim
ARG PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple
RUN apt-get update && apt-get install -y --no-install-recommends \
nginx supervisor curl sqlite3 && \
rm -rf /var/lib/apt/lists/* && \
rm -f /etc/nginx/sites-enabled/default
WORKDIR /app
ENV PIP_NO_CACHE_DIR=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_INDEX_URL=${PIP_INDEX_URL}
ENV PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}
ENV PIP_TRUSTED_HOST=mirrors.aliyun.com
# 后端源码 + 依赖安装
COPY pyproject.toml constraints.txt ./
COPY packages/ packages/
COPY apps/ apps/
RUN pip install --no-cache-dir -c constraints.txt ".[llm,pdf]" && \
pip install --no-cache-dir -c constraints.txt umap-learn
# Alembic 数据库迁移
COPY alembic.ini ./
COPY infra/migrations/ infra/migrations/
# 前端构建产物
COPY --from=frontend /build/dist /app/frontend/dist
# 部署配置
COPY infra/nginx.conf /etc/nginx/conf.d/researchos.conf
COPY infra/supervisord.conf /etc/supervisor/conf.d/researchos.conf
# 数据目录(运行时由 volume 覆盖)
RUN mkdir -p /app/data/papers /app/data/briefs
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -sf http://localhost:8000/health || exit 1
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/researchos.conf"]