prepare fastapi root layout for server deployment
This commit is contained in:
+11
-12
@@ -2,27 +2,26 @@ FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
APP_ENV=production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY backend/requirements.txt ./requirements.txt
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
||||
--no-cache-dir \
|
||||
-r requirements.txt
|
||||
|
||||
COPY backend ./backend
|
||||
COPY app ./app
|
||||
COPY scripts ./scripts
|
||||
COPY pyproject.toml README.md ./
|
||||
|
||||
WORKDIR /app/backend
|
||||
RUN mkdir -p /app/logs /app/storage/reports
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
CMD [
|
||||
"uvicorn",
|
||||
"app.main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"9000"
|
||||
]
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:9000/health/live', timeout=3)"
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "9000", "--proxy-headers", "--forwarded-allow-ips=*"]
|
||||
|
||||
Reference in New Issue
Block a user