pikpak 自动登陆验证 加入到docker中 ai识别python的文件较大

pull/7108/head
xiaokai 2024-08-30 15:12:01 +07:00
parent 7c6c79ca2e
commit 188276eab5
2 changed files with 52 additions and 11 deletions

View File

@ -1,26 +1,60 @@
FROM alpine:edge as builder
LABEL stage=go-builder
FROM ubuntu AS build_alist
WORKDIR /app/
RUN apk add --no-cache bash curl gcc git go musl-dev
# RUN apt update && apt install bash curl gcc git go musl-dev
# 安装基本工具
RUN apt update && \
apt install -y software-properties-common && \
add-apt-repository ppa:longsleep/golang-backports && \
apt update && \
apt install -y bash curl gcc git golang-go musl-dev
COPY go.mod go.sum ./
RUN go mod download
COPY ./ ./
RUN bash build.sh release docker
FROM alpine:edge
FROM ubuntu AS install_py
RUN apt update && \
apt install -y curl python3 python3-pip python3.12-venv
WORKDIR /app/auto_pikpak/
# RUN curl -O -L https://raw.githubusercontent.com/wangjunkai2022/auto_pikpak/main/requirements.txt requirements.txt
# RUN curl -O -L https://raw.githubusercontent.com/wangjunkai2022/auto_pikpak/main/requirements.txt requirements.txt
# 创建虚拟环境并激活
RUN python3 -m venv venv && \
. venv/bin/activate && \
pip install \
PyYAML \
selenium \
pyTelegramBotAPI \
pyrclone \
httpx \
numpy \
opencv_python \
opencv_python_headless \
ultralytics \
2captcha-python \
Flask
FROM ubuntu as pikpak_server
RUN apt update && \
apt install -y git
WORKDIR /app
RUN git clone https://github.com/wangjunkai2022/auto_pikpak.git --depth 1
WORKDIR /app/auto_pikpak
COPY --from=install_py /app/auto_pikpak/venv /app/auto_pikpak/venv
FROM ubuntu
ARG INSTALL_FFMPEG=false
LABEL MAINTAINER="i@nn.ci"
WORKDIR /opt/alist/
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache bash ca-certificates su-exec tzdata; \
[ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
rm -rf /var/cache/apk/*
RUN apt update && \
apt upgrade -y && \
apt install -y bash ca-certificates tzdata ffmpeg
COPY --from=builder /app/bin/alist ./
# 复制 auto_pikpak 到第二阶段
COPY --from=pikpak_server /app/auto_pikpak /app/auto_pikpak
COPY --from=build_alist /app/bin/alist ./
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && /entrypoint.sh version

View File

@ -3,9 +3,16 @@
chown -R ${PUID}:${PGID} /opt/alist/
umask ${UMASK}
# 指定 Python 程序的工作目录
PYTHON_DIR="/app/auto_pikpak"
# 启动 Python 程序
(
cd "$PYTHON_DIR" && /app/auto_pikpak/venv/bin/python3 server.py &
)
if [ "$1" = "version" ]; then
./alist version
else
exec su-exec ${PUID}:${PGID} ./alist server --no-prefix
exec ./alist server --no-prefix
fi