# Story 事件协作 Web 编辑器(M6 部署)。 # 构建上下文 = tools/event_authoring (需含 ir_core / ir_dictionary.json / web)。 # docker build -f web/Dockerfile -t story-event-web . # 或用 web/docker-compose.yml 一键起。 FROM python:3.12-slim WORKDIR /app # 仅装后端运行依赖(编译器是纯 Python 标准库,无需额外包) # PIP_INDEX_URL 默认官方源(可移植);国内构建可 --build-arg 指向清华等镜像加速。 ARG PIP_INDEX_URL=https://pypi.org/simple COPY web/requirements.txt ./web/requirements.txt RUN pip install --no-cache-dir --index-url ${PIP_INDEX_URL} -r web/requirements.txt # 编译/校验内核 + 外置词典 + 后端 + 前端 COPY ir_core ./ir_core COPY ir_dictionary.json ./ir_dictionary.json COPY web ./web # SQLite 持久化目录(挂卷到此);点位集挂载到 /pointsets(只读) ENV STORY_DB_PATH=/data/story_events.db \ STORY_POINTSETS_DIR=/pointsets \ STORY_WEB_PASSWORD=story RUN mkdir -p /data /pointsets EXPOSE 8787 WORKDIR /app/web # 探测首页(静态,恒 200):/api/* 无凭证会 401 且 urlopen 会抛异常,故改打 / 。 HEALTHCHECK --interval=30s --timeout=4s --start-period=8s --retries=3 \ CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8787/',timeout=3).status==200 else 1)" CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8787"]