From e1c62f23d3cf06a417186db190e7dd7481e04a75 Mon Sep 17 00:00:00 2001 From: oscar Date: Mon, 17 Mar 2025 10:25:29 +0800 Subject: [PATCH] modify scripts --- golang-dev/Dockerfile | 3 +-- stock/Dockerfile | 24 ++++++++++++++---------- stock/requirements.txt | 11 +++++++++++ 3 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 stock/requirements.txt diff --git a/golang-dev/Dockerfile b/golang-dev/Dockerfile index e65067b..3fd6e6e 100644 --- a/golang-dev/Dockerfile +++ b/golang-dev/Dockerfile @@ -1,11 +1,10 @@ # 选择基础镜像,使用 Ubuntu 最新版本 -#FROM ubuntu:latest FROM --platform=linux/amd64 ubuntu:latest # 设置时区,避免交互式输入 ENV DEBIAN_FRONTEND=noninteractive -# 安装基础工具和 Golang +# 安装基础工具和 开发工具包 build-essential RUN apt-get update && apt-get install -y \ curl wget git vim build-essential \ && rm -rf /var/lib/apt/lists/* diff --git a/stock/Dockerfile b/stock/Dockerfile index fb32961..4bba2d7 100644 --- a/stock/Dockerfile +++ b/stock/Dockerfile @@ -1,18 +1,22 @@ # 使用 Ubuntu 最新的 x86_64 版本 FROM --platform=linux/amd64 ubuntu:latest -# 设置时区环境变量 -ENV TZ=Asia/Shanghai -RUN apt update && apt install -y tzdata && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +# 设置时区,避免交互式输入 +ENV DEBIAN_FRONTEND=noninteractive -# 安装必要的系统包 -RUN apt update && \ - apt install -y python3 python3-pip git wget curl unzip nano && \ - apt clean && rm -rf /var/lib/apt/lists/* +# 安装必要的系统包,和python环境 +RUN apt-get update && apt-get install -y \ + curl wget git vim unzip nano python3 python3-pip \ + && rm -rf /var/lib/apt/lists/* -# 设置 Python 环境 -# RUN pip install --upgrade pip --break-system-packages && \ -RUN pip install --upgrade cloudscraper requests BeautifulSoup4 lxml pymysql futu-api cryptography --break-system-packages +# 创建工作目录 +WORKDIR /app + +# 将 requirements.txt 复制到工作目录 +COPY requirements.txt . + +# 安装项目依赖 +RUN pip3 install -r requirements.txt --break-system-packages # 设置 Git 配置 RUN git config --global user.name "oscar" && \ diff --git a/stock/requirements.txt b/stock/requirements.txt new file mode 100644 index 0000000..136eb4c --- /dev/null +++ b/stock/requirements.txt @@ -0,0 +1,11 @@ +# 绕过cloudflare限制的包 +cloudscraper + +requests +beautifulsoup4 +lxml +pymysql + +# futu openapi 包,以及它依赖的加密库 +futu-api +cryptography \ No newline at end of file