25.09.16 update

This commit is contained in:
jinql
2025-09-16 16:12:38 +08:00
parent 96a975b9ad
commit c5dd60a82d
4 changed files with 33 additions and 38 deletions

View File

@@ -1,36 +1,19 @@
FROM python:3.13-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt
RUN pip wheel --no-cache-dir --wheel-dir /app/wheels -r requirements.txt
COPY . .
RUN python -m compileall -b . && find . -name "*.py" -delete
RUN python -m compileall -b .
FROM python:3.13-slim
WORKDIR /app
COPY --from=builder /app/wheels /wheels
COPY --from=builder /app/requirements.txt .
RUN pip install --no-cache /wheels/*
COPY --from=builder /app /app
RUN find . -type d -name "__pycache__" | while read -r dir; do \
module_dir=$(dirname "$dir"); \
mv "$dir"/*.pyc "$module_dir/"; \
rmdir "$dir"; \
done
RUN find . -name "*.py" -delete
RUN pip install --no-cache /app/wheels/* && chmod +x /app/entrypoint.sh && rm -rf /wheels /app/wheels
EXPOSE 8000
VOLUME ["/app/data", "/app/conf", "/app/logs"]
VOLUME ["/app/data", "/app/logs"]
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["gunicorn", "-c", "conf/gunicorn.conf.py", "main:app"]