diff --git a/DockerFile b/DockerFile deleted file mode 100644 index 84cb85d..0000000 --- a/DockerFile +++ /dev/null @@ -1,17 +0,0 @@ -# 使用官方Python运行时作为父镜像 -FROM python:3.9-slim - -# 设置容器内的工作目录 -WORKDIR /app - -# 将当前目录内容复制到容器的 /app 下 -COPY . /app - -# 安装项目所需的依赖 -RUN pip install --no-cache-dir -r requirements.txt - -# 声明容器运行时监听的端口号 -EXPOSE 8080 - -# 定义容器启动后执行的命令 -CMD ["python", "app.py"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index da7cd7f..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: '3' -services: - web: - build: . - ports: - - "8080:8080" - # 可以在此定义数据库等服务 \ No newline at end of file diff --git a/dokcer/DockerFile b/dokcer/DockerFile new file mode 100644 index 0000000..613424c --- /dev/null +++ b/dokcer/DockerFile @@ -0,0 +1,7 @@ +FROM python:3.10-slim +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt # 禁用缓存减小体积 +COPY . . +EXPOSE 8000 +CMD ["python3","./run.py"] \ No newline at end of file diff --git a/dokcer/docker-compose.yml b/dokcer/docker-compose.yml new file mode 100644 index 0000000..7763a72 --- /dev/null +++ b/dokcer/docker-compose.yml @@ -0,0 +1,13 @@ +services: + stock-monitor: + build: + context: .. + dockerfile: ./dokcer/DockerFile + container_name: stock-monitor-app + restart: unless-stopped + ports: + - "15348:8000" + environment: + - PYTHONUNBUFFERED=1 + volumes: + - .:/app \ No newline at end of file