crypto.ai/Dockerfile
2025-04-29 00:38:22 +08:00

43 lines
797 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM python:3.13-slim
# 设置工作目录
WORKDIR /app
# 安装基本依赖
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# 复制项目文件
COPY . /app/
# 创建虚拟环境, 先判断是否存在
RUN if [ ! -d "venv" ]; then \
python -m venv venv; \
fi
# 激活虚拟环境
RUN source venv/bin/activate
# 安装setuptools
RUN pip install setuptools
# 安装Python依赖
RUN pip install -r requirements.txt
# 设置环境变量
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# 创建配置文件目录
RUN mkdir -p /app/config
# 创建数据目录
RUN mkdir -p /app/cryptoai/data /app/logs
# 暴露端口如果有Web服务
# EXPOSE 8000
# 设置容器启动命令
ENTRYPOINT ["python", "run.py"]