添加docker文件

This commit is contained in:
Administrator 2023-07-13 13:31:39 +08:00
parent eca26a7e3a
commit 0bf14e9694
2 changed files with 17 additions and 10 deletions

View File

@ -8,10 +8,9 @@ WORKDIR /app
COPY requirements.txt .
# 安装项目依赖
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
# 复制项目代码到容器内的 /app 目录
COPY . .
# 设置环境变量,指定端口号和主模块
ENV PORT=8000
@ -20,5 +19,5 @@ ENV MODULE_NAME=my_fastapi_app.main:app
# 暴露指定的端口
EXPOSE $PORT
# 启动 FastAPI 应用
CMD python main.py
## 启动 FastAPI 应用
#CMD python main.py

View File

@ -1,8 +1,16 @@
version: "3"
version: '3'
services:
fastapi-app:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../daily:/home/daily
ports:
- "8000:8000"
- "8001:8082"
networks:
- app
command:
cd /home/video_search && python3 main.py'
networks:
app:
driver: bridge