From 0bf14e9694e11cc3695c412b8b6140ed0a18c379 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 13 Jul 2023 13:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0docker=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 +++---- docker-compose.yml | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6264d80..87e06aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index e474cec..13a9043 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,16 @@ -version: "3" +version: '3' services: - fastapi-app: - build: - context: . - dockerfile: Dockerfile + build: + context: . + dockerfile: Dockerfile + volumes: + - ../daily:/home/daily ports: - - "8000:8000" \ No newline at end of file + - "8001:8082" + networks: + - app + command: + cd /home/video_search && python3 main.py' +networks: + app: + driver: bridge \ No newline at end of file