update dockerfile
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -1,5 +1,18 @@
|
|||||||
FROM python:3.9-slim
|
# 使用 Python 3.12 的官方镜像
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 将项目文件拷贝到容器中
|
||||||
COPY . /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"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user