Files
kami_jd_ck/bind_card/Dockerfile
2025-04-13 19:17:51 +08:00

40 lines
1.0 KiB
Docker

# 基于 Python 3.9-slim 镜像
FROM python:3.9-slim
# 修改apt-get源地址为阿里云镜像
RUN echo "" > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian buster main" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian buster-updates main" >> /etc/apt/sources.list
# 安装必要的工具和依赖
RUN apt-get update && apt-get install -y \
curl \
gnupg \
libgl1-mesa-glx \
libglib2.0-0 \
&& curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# 复制项目
ADD . /app
# 设置工作目录
WORKDIR /app
# 暴露容器端口
EXPOSE 5001
# 安装cv2依赖和其他依赖
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0
# python环境包
RUN pip install --no-cache-dir -r requirements.txt
ENV FLASK_APP=app.py
# 运行应用
CMD ["python", "app.py"]