33 lines
642 B
Docker
33 lines
642 B
Docker
# 使用Python 3.8作为基础镜像
|
|
FROM python:3.8-slim
|
|
|
|
# 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 安装系统依赖
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 复制requirements.txt
|
|
COPY requirements.txt .
|
|
|
|
# 安装Python依赖
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 安装项目所需的Python包
|
|
RUN pip install --no-cache-dir \
|
|
tensorflow \
|
|
keras \
|
|
scikit-learn \
|
|
numpy \
|
|
pandas
|
|
|
|
# 复制项目文件
|
|
COPY . .
|
|
|
|
# 设置环境变量
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# 设置容器启动命令
|
|
CMD ["python", "DNN_final.py"] |