锵锵枪 wrote:
网站使用Docker运行 ![](https://wx1.sinaimg.cn/large/00631gN3ly4h3y2np3gy8j30go09bjrt.jpg) 买了个腾讯云的主机玩,顺便把网站签过去,迁移觉得很麻烦,搞成容器直接run就可以了。 于是就直接搞。 docker search 发现有打好的fastapi镜像,但是还是自己动手用官方的python3镜像自己做踏实。 ``` #基础镜像 FROM 3.9.13-slim-bullseye #工作目录 WORKDIR /www #安装依赖包 COPY requirements.txt ./ RUN pip install requirements.txt EXPOSE 8000 8000 CMD["gunicorn","xxx.main:app","-w","4","-k","uvicorn.workers.UvicornWorker","-D","-b","127.0.0.1:8080"] ```
锵锵枪 2022-07-07 09:52:54  0 回复