| # 使用多阶段构建 | |
| FROM node:18-alpine as node-builder | |
| WORKDIR /app | |
| COPY package*.json ./ | |
| RUN npm install --production | |
| COPY . . | |
| FROM python:3.9-slim | |
| WORKDIR /app | |
| # 复制Node.js环境和代码 | |
| COPY --from=node-builder /app /app | |
| # 安装Python依赖 | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 设置环境变量 | |
| ENV NODE_ENV=production | |
| ENV PORT=3099 | |
| EXPOSE 7860 3099 | |
| # 启动命令 | |
| CMD streamlit run streamlit_app.py --server.port=7860 --server.address=0.0.0.0 | |