From 464fad13054a11ecc789b288172262ef824ab7a4 Mon Sep 17 00:00:00 2001 From: YuanHui <31339626+alsesa@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:55:35 +0800 Subject: [PATCH] update dockerfile --- Dockerfile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c804f4..b6ad2d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,18 @@ -FROM python:3.9-slim +# 使用 Python 3.12 的官方镜像 +FROM python:3.12-slim + +# 设置工作目录 WORKDIR /app + +# 将项目文件拷贝到容器中 COPY . /app -RUN pip install -r requirements.txt -CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"] + +# 安装项目依赖 +RUN pip install --no-cache-dir -r requirements.txt + +# 暴露应用端口 +EXPOSE 8000 + +# 启动命令 +CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] +