35 lines
912 B
Docker
35 lines
912 B
Docker
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt /app/requirements.txt
|
|
# 国内服务器从默认PyPI下载大型识别组件可能超时;可用构建参数覆盖源。
|
|
ARG PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
python -m pip install --disable-pip-version-check --retries 3 --timeout 120 \
|
|
--index-url "${PIP_INDEX_URL}" -r /app/requirements.txt
|
|
RUN python -c "import PIL, rapidocr, onnxruntime, cv2"
|
|
|
|
COPY server /app/server
|
|
COPY duty /app/duty
|
|
COPY dist /app/dist
|
|
COPY config.toml /app/config.toml
|
|
COPY seed /app/seed
|
|
|
|
RUN mkdir -p /app/data
|
|
|
|
ENV WORKLOG_HOST=0.0.0.0 \
|
|
WORKLOG_PORT=37777 \
|
|
WORKLOG_DB=/app/data/worklog.db \
|
|
WORKLOG_FRONTEND=/app/dist
|
|
|
|
EXPOSE 37777
|
|
|
|
VOLUME /app/data
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["python", "-m", "server.main"]
|