40 lines
1.2 KiB
Docker
40 lines
1.2 KiB
Docker
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
libgl1 \
|
|
libglib2.0-0 \
|
|
libgomp1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt /app/requirements.txt
|
|
RUN python -m pip install --upgrade pip setuptools wheel \
|
|
&& python -m pip install --extra-index-url https://download.pytorch.org/whl/cpu \
|
|
"torch==2.6.0+cpu" "torchvision==0.21.0+cpu" \
|
|
&& python -m pip install -r /app/requirements.txt
|
|
|
|
COPY app /app/app
|
|
COPY config /app/config
|
|
COPY data /app/data
|
|
COPY scripts/docker-entrypoint.sh /app/scripts/docker-entrypoint.sh
|
|
COPY weights /app/weights
|
|
COPY README.md README_zh.md /app/
|
|
|
|
RUN test -f /app/weights/yolo11n.pt \
|
|
&& chmod +x /app/scripts/docker-entrypoint.sh
|
|
|
|
EXPOSE 18081
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:18081/api/manage/health', timeout=3).read()" || exit 1
|
|
|
|
ENTRYPOINT ["/app/scripts/docker-entrypoint.sh"]
|