update
This commit is contained in:
parent
ab39576a45
commit
e7332a8efc
21
Dockerfile
21
Dockerfile
@ -5,7 +5,17 @@ WORKDIR /app
|
||||
|
||||
# 设置环境变量
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONIOENCODING=utf-8 \
|
||||
TZ=Asia/Shanghai
|
||||
|
||||
# 设置时区
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
# 替换为国内apt源
|
||||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
||||
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
|
||||
|
||||
# 安装系统依赖
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
@ -17,6 +27,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 设置pip镜像源
|
||||
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ \
|
||||
&& pip config set install.trusted-host mirrors.aliyun.com \
|
||||
&& pip install --no-cache-dir --upgrade pip setuptools wheel
|
||||
|
||||
# 复制项目文件
|
||||
COPY . /app/
|
||||
|
||||
@ -31,5 +46,9 @@ USER appuser
|
||||
# 暴露端口
|
||||
EXPOSE 9001
|
||||
|
||||
# 设置健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:9001/health || exit 1
|
||||
|
||||
# 启动命令
|
||||
CMD ["uvicorn", "run:app", "--host", "0.0.0.0", "--port", "9001"]
|
||||
Loading…
Reference in New Issue
Block a user