2026-06-05 02:13:49 +08:00
|
|
|
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2026-07-24 03:28:29 +08:00
|
|
|
libpq-dev curl \
|
2026-06-05 02:13:49 +08:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
RUN groupadd --gid 1000 appgroup && \
|
|
|
|
|
useradd --uid 1000 --gid appgroup --shell /bin/bash --create-home appuser
|
|
|
|
|
|
2026-07-24 03:28:29 +08:00
|
|
|
WORKDIR /app
|
2026-06-05 02:13:49 +08:00
|
|
|
|
|
|
|
|
COPY --chown=appuser:appgroup requirements.txt .
|
2026-07-24 03:28:29 +08:00
|
|
|
RUN pip install --no-cache-dir -r requirements.txt \
|
|
|
|
|
-i https://pypi.tuna.tsinghua.edu.cn/simple
|
2026-06-05 02:13:49 +08:00
|
|
|
|
|
|
|
|
COPY --chown=appuser:appgroup . .
|
|
|
|
|
|
|
|
|
|
USER appuser
|
|
|
|
|
|
2026-07-24 03:28:29 +08:00
|
|
|
ENV CBPOA_ROOT=/data
|
2026-06-05 02:13:49 +08:00
|
|
|
EXPOSE 8000
|
|
|
|
|
|
2026-07-24 03:28:29 +08:00
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
|
2026-06-05 02:13:49 +08:00
|
|
|
CMD curl -f http://localhost:8000/docs || exit 1
|
|
|
|
|
|
|
|
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|