Files
managed-portal/managed/people_flow_project/Dockerfile

43 lines
1.5 KiB
Docker

FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/python:3.12-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
DEEPFACE_HOME=/root/.deepface \
TF_CPP_MIN_LOG_LEVEL=2
WORKDIR /opt/people-flow
RUN sed -i 's|http://deb.debian.org/debian|http://mirrors.aliyun.com/debian|g; s|http://deb.debian.org/debian-security|http://mirrors.aliyun.com/debian-security|g' /etc/apt/sources.list.d/debian.sources && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libglib2.0-0 \
libgl1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements-docker.txt ./requirements-docker.txt
RUN pip install "numpy<2"
RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu \
"torch==2.6.0+cpu" "torchvision==0.21.0+cpu"
RUN pip install "tensorflow==2.16.1" "tf-keras==2.16.0"
RUN pip install -r requirements-docker.txt
COPY . .
COPY scripts/docker-entrypoint.sh /opt/people-flow/scripts/docker-entrypoint.sh
RUN mkdir -p /root/.deepface/weights /opt/people-flow/outputs && \
chmod +x /opt/people-flow/scripts/docker-entrypoint.sh
EXPOSE 18082
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:18082/api/manage/health', timeout=3).read()" || exit 1
ENTRYPOINT ["/opt/people-flow/scripts/docker-entrypoint.sh"]