diff --git a/api.py b/api.py index 8dfc9d6..6bb596d 100644 --- a/api.py +++ b/api.py @@ -9,9 +9,9 @@ from download import M3U8Downloader from function import crawl_missav app = Flask(__name__) -app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'your-secret-key-here') +app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', '123456') -downloader = M3U8Downloader(max_workers=10, output_dir=r"download") +downloader = M3U8Downloader(max_workers=10, output_dir=r"/app/download") # 从环境变量获取用户名密码 USERNAME = os.getenv('USER') diff --git a/docker/Dockerfile b/docker/Dockerfile index 6020c5d..5e1da2f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,15 @@ FROM ubuntu:24.04 +# 备份并重建 sources.list - 使用阿里云镜像 +RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \ + echo "deb http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse" > /etc/apt/sources.list && \ + echo "deb http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo "deb http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo "deb http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse" >> /etc/apt/sources.list + +# 删除可能存在的其他源文件 +RUN rm -rf /etc/apt/sources.list.d/* + # 安装系统依赖 RUN apt-get update && apt-get install -y \ nginx \ @@ -19,7 +29,7 @@ RUN apt-get update && apt-get install -y \ libxfixes3 \ libxrandr2 \ libgbm1 \ - libasound2 \ + libasound2t64 \ libpango-1.0-0 \ libcairo2 \ libatspi2.0-0 \ @@ -29,23 +39,28 @@ RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ && rm -rf /var/lib/apt/lists/* + # 设置工作目录 WORKDIR /app # 复制server文件 COPY ./server/* /app/server/ +# 复制html文件 +COPY ./html/ /app/html/ + # 复制nginx配置文件 COPY ./nginx.conf /etc/nginx/nginx.conf # 安装Python依赖 -RUN pip install --no-cache-dir -r /app/server/requirements.txt +RUN pip install --break-system-packages --proxy http://192.168.1.2:7890 -r /app/server/requirements.txt -# 配置Playwright代理和安装Chromium +# 设置Playwright使用国内镜像安装浏览器 +ENV PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright RUN playwright install chromium # 创建下载目录和nginx运行所需目录 -RUN mkdir -p /app/server/download /var/run/nginx +RUN mkdir -p /app/download /var/run/nginx # 设置环境变量 ENV USER=admin @@ -53,7 +68,7 @@ ENV PASSWORD=password ENV SECRET_KEY='asd78yujncisa32r89' # 设置卷 -VOLUME ["/app/server/download"] +VOLUME ["/app/download"] # 暴露端口 EXPOSE 80 diff --git a/docker/html/home.html b/docker/html/home.html deleted file mode 100644 index 8cf1b86..0000000 --- a/docker/html/home.html +++ /dev/null @@ -1,639 +0,0 @@ - - -
- - -