ea23863e4d
- 新增 api/static/wine/ATP/tpbig.exe (1.3MB):从 atp-models 工程引入 - 新增 api/static/wine/atp/tpbig.exe (1.3MB):从 atp-models 工程引入 - 新增 api/docker-entrypoint.sh:容器启动时自动将 tpbig.exe 复制到 wine_allowed_root(/app/data/wine/) 的对应路径下,兼容 bind mount - 更新 api/Dockerfile:COPY static/ → /app/static/,设置 ENTRYPOINT 为 docker-entrypoint.sh 原理:Docker Compose 将 ./data/app 以 bind mount 挂载到 /app/data, 镜像中 /app/data 下的内容会被隐藏。通过 entrypoint 在启动时检查并 复制 tpbig.exe 到 bind mount 目录中,确保无论 volume 是否为空都能 正确初始化。
42 lines
1.3 KiB
Docker
42 lines
1.3 KiB
Docker
ARG PYTHON_BASE_IMAGE=docker.m.daocloud.io/library/python:3.11-slim
|
|
FROM ${PYTHON_BASE_IMAGE}
|
|
|
|
WORKDIR /app
|
|
|
|
ARG PIP_INDEX_URL=https://pypi.org/simple
|
|
ARG PIP_DEFAULT_TIMEOUT=300
|
|
ARG PIP_RETRIES=20
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
ENV PIP_DEFAULT_TIMEOUT=${PIP_DEFAULT_TIMEOUT}
|
|
ENV PIP_RETRIES=${PIP_RETRIES}
|
|
|
|
RUN dpkg --add-architecture i386 \
|
|
&& apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
libexpat1 \
|
|
wine \
|
|
wine32:i386 \
|
|
&& command -v wine >/dev/null \
|
|
&& dpkg-query -W -f='${Status}' wine32:i386 | grep -q "install ok installed" \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir --retries "${PIP_RETRIES}" --timeout "${PIP_DEFAULT_TIMEOUT}" -i "${PIP_INDEX_URL}" -r requirements.txt
|
|
RUN python -c "import rasterio; print('rasterio ready:', rasterio.__version__)"
|
|
|
|
# Static assets (tpbig.exe, etc.)
|
|
COPY static/ /app/static/
|
|
|
|
# Entrypoint: ensures tpbig.exe is available in runtime volume
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
COPY app ./app
|
|
|
|
EXPOSE 8000
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--ws", "wsproto"]
|