FROM python:3.12-slim-bookworm ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 WORKDIR /app RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates adduser \ && rm -rf /var/lib/apt/lists/* \ && adduser --disabled-password --gecos "" --uid 10001 app COPY requirements.txt . RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt \ || pip install --no-cache-dir -r requirements.txt COPY docker-entrypoint.sh /entrypoint.sh COPY app ./app RUN chmod 755 /entrypoint.sh && chown -R app:app /app USER app EXPOSE 8000 ENTRYPOINT ["/entrypoint.sh"]