docker
This commit is contained in:
+5
-3
@@ -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}"]
|
||||
|
||||
Reference in New Issue
Block a user