build(docker): 更新 Docker Compose 配置和 Dockerfile
- 新增 docker-compose.yml 文件,配置 Python 应用服务 - 更新 Dockerfile: - 调整文件结构,先复制再安装依赖 - 移除冗余的 COPY 指令 - 更新 CMD 指令,简化路径 - 注释掉端口映射,可根据需要手动配置
This commit is contained in:
parent
c045214969
commit
83fe44d7be
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: '1.0'
|
||||||
|
services:
|
||||||
|
python-app:
|
||||||
|
build: .
|
||||||
|
container_name: python-app
|
||||||
|
volumes:
|
||||||
|
- ./:/app
|
||||||
|
ports:
|
||||||
|
- "5555:5555" # 如果需要暴露 Flask 端口
|
||||||
@ -1,7 +1,7 @@
|
|||||||
FROM python:latest
|
FROM python:latest
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
RUN python setup.py install
|
RUN python setup.py install
|
||||||
COPY . /app
|
|
||||||
EXPOSE 5555
|
CMD ["python", "alibabacloud_sample/main.py"]
|
||||||
CMD ["python", "/app/alibabacloud_sample/main.py"]
|
|
||||||
Loading…
Reference in New Issue
Block a user