This commit is contained in:
2026-10-01 23:47:20 +03:00
parent e47a45dc93
commit 86222f5f93
6 changed files with 49 additions and 11 deletions
+5 -3
View File
@@ -19,11 +19,13 @@ COPY openapi.yaml ./openapi.yaml
# процесса только конфигурация из окружения (FR-006, NFR-008).
USER appuser
ENV HOST=0.0.0.0 \
PORT=8000 \
PORT=8010 \
WORKERS=2
EXPOSE 8000
EXPOSE 8010
# Порт берётся из PORT (совпадает с привязкой uvicorn в ENTRYPOINT);
# urlopen бросает исключение при отказе/не-2xx → ненулевой код → unhealthy.
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD ["python", "-c", "import urllib.request,sys; r=urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3); sys.exit(0 if r.status==200 else 1)"]
CMD ["python", "-c", "import os,urllib.request,sys; urllib.request.urlopen('http://127.0.0.1:%s/health' % os.environ.get('PORT', '8010'), timeout=3); sys.exit(0)"]
ENTRYPOINT ["sh", "-c", "exec uvicorn app.main:create_app --factory --no-access-log --host ${HOST} --port ${PORT} --workers ${WORKERS}"]