File size: 822 Bytes
e4e7d23
3d45093
e4e7d23
 
 
3d45093
e4e7d23
 
3d45093
e4e7d23
 
3d45093
 
e4e7d23
82ef1e8
 
 
 
 
 
e4e7d23
 
 
 
 
 
3d45093
e4e7d23
3d45093
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 使用官方的 Python 基础镜像
FROM python:3.12.2

# 设置构建参数和环境变量
ARG NAME="default_name"
ENV NAME=${NAME}

# 设置工作目录
WORKDIR /app

# 复制应用程序文件
COPY app.py requirements.txt /app/

# 安装 Python 依赖
RUN apt-get update && apt-get install -y libgl1-mesa-glx

# 安装应用依赖
RUN pip install --upgrade opencv-python
# RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir -r requirements.txt
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir

# 暴露端口
EXPOSE 8090

# 健康检查(可选,根据应用程序情况调整)
# HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost:8090/health || exit 1

# 设置容器启动命令
CMD ["python", "-u", "app.py"]