-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.modelscope
More file actions
50 lines (38 loc) · 1.24 KB
/
Dockerfile.modelscope
File metadata and controls
50 lines (38 loc) · 1.24 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
# === Stage 1: Build Frontend ===
FROM node:20-alpine AS frontend-builder
WORKDIR /workspace
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
# === Stage 2: Build Backend Runtime ===
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# 安装依赖
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# 复制应用代码
COPY apps /app/apps
COPY scripts /app/scripts
COPY --from=frontend-builder /workspace/dist /app/dist
# 复制入口脚本
COPY apps/portal-backend/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh \
&& mkdir -p /app/.local/runs /app/.local/artifacts
# 复制 app.py(魔搭入口)
COPY app.py /app/app.py
ENV PYTHONPATH=/app/apps/portal-backend
ENV FRONTEND_DIST=/app/dist
ENV LOCAL_RUN_ROOT=/app/.local/runs
ENV PORT=7860
ENV DATABASE_URL=sqlite:///rl_platform.db
ENV DISABLE_CSP=1
EXPOSE 7860 6006
# 魔搭创空间可以使用 app.py 或 entrypoint.sh
# 如果使用 app.py,取消下面的注释
# CMD ["python", "app.py"]
# 使用 entrypoint.sh(推荐,包含数据库初始化等)
ENTRYPOINT ["/app/entrypoint.sh"]