feat: 初始化项目

This commit is contained in:
eric
2022-12-14 14:08:01 +08:00
parent 728e170725
commit 360e27457b
4 changed files with 103 additions and 0 deletions

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
# 1、从官方 Python 基础镜像开始
FROM python:3.9
# 2、将当前工作目录设置为 /code
# 这是放置 requirements.txt 文件和应用程序目录的地方
WORKDIR /code
# 3、先复制 requirements.txt 文件
# 由于这个文件不经常更改Docker 会检测它并在这一步使用缓存,也为下一步启用缓存
COPY ./requirements.txt /code/requirements.txt
# 4、运行 pip 命令安装依赖项
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# 5、复制 FastAPI 项目代码
COPY ./app /code/app
# 6、运行服务
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]