build(docker): 更新 Docker Compose 配置和 Dockerfile

- 新增 docker-compose.yml 文件,配置 Python 应用服务
- 更新 Dockerfile:
  - 调整文件结构,先复制再安装依赖
  - 移除冗余的 COPY 指令  - 更新 CMD 指令,简化路径
  - 注释掉端口映射,可根据需要手动配置
This commit is contained in:
liuxiaoqing 2025-08-18 14:01:14 +08:00
parent c045214969
commit 83fe44d7be
2 changed files with 12 additions and 3 deletions

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: '1.0'
services:
python-app:
build: .
container_name: python-app
volumes:
- ./:/app
ports:
- "5555:5555" # 如果需要暴露 Flask 端口

View File

@ -1,7 +1,7 @@
FROM python:latest
WORKDIR /app
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
RUN python setup.py install
COPY . /app
EXPOSE 5555
CMD ["python", "/app/alibabacloud_sample/main.py"]
CMD ["python", "alibabacloud_sample/main.py"]