commit
315eb7d884
4
.gitignore
vendored
4
.gitignore
vendored
@ -136,3 +136,7 @@ dmypy.json
|
||||
|
||||
#自己用的推送((
|
||||
push_main.py
|
||||
|
||||
# 避免上传配置文件
|
||||
.idea/
|
||||
config/*.json
|
||||
|
26
Dockerfile
Normal file
26
Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
FROM python:3.8-slim-buster
|
||||
LABEL maintainer="mailto@wolfbolin.com"
|
||||
|
||||
# Why need these step?
|
||||
# - fast mirror source
|
||||
# - procps contains useful proccess control commands like: free, kill, pkill, ps, top
|
||||
# - wget is quite basic tool
|
||||
# - vim for online debugging
|
||||
# - sync timezone
|
||||
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
|
||||
&& sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends procps wget vim \
|
||||
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
# Project environment
|
||||
WORKDIR /var/app
|
||||
COPY . /var/app
|
||||
COPY ./Config/openssl.cnf /etc/ssl
|
||||
|
||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip \
|
||||
&& pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
||||
|
||||
# Docker operation parameters
|
||||
ENV MULTI TRUE
|
||||
|
||||
CMD if [ $MULTI==TRUE ];then python main_multi.py autorun;else python main.py;fi
|
49
README.md
49
README.md
@ -60,6 +60,55 @@
|
||||
|
||||
7. **此时Cookie已经复制到你的粘贴板上了**
|
||||
|
||||
|
||||
|
||||
## 使用Docker运行
|
||||
|
||||
Docker的运行脚本基于Linux平台编写,暂未在Win平台测试。
|
||||
|
||||
将本项目Clone至本地后,请先按照上述步骤添加或修改配置文件。随后运行`make-docker.sh`脚本本地构建Docker镜像,同时初次运行容器。
|
||||
|
||||
```shell
|
||||
sh make-docker.sh
|
||||
```
|
||||
|
||||
或手动执行
|
||||
|
||||
```
|
||||
# 编译容器
|
||||
docker build -f Dockerfile --tag ${docker_name}:"${time_now}" .
|
||||
```
|
||||
|
||||
```
|
||||
# 运行容器(默认自动多配置文件)
|
||||
docker run -itd \
|
||||
--name ${docker_name} \
|
||||
--log-opt max-size=1m \
|
||||
-v $(pwd):/var/app \
|
||||
${docker_name}:"${time_now}"
|
||||
# 运行容器(直接运行main.py)
|
||||
docker run -itd \
|
||||
--name ${docker_name} \
|
||||
--log-opt max-size=1m \
|
||||
-v $(pwd):/var/app \
|
||||
-e MULTI=FALSE \
|
||||
${docker_name}:"${time_now}"
|
||||
```
|
||||
|
||||
若需要添加配置文件或修改配置文件,可直接在主机config文件夹中修改,修改的内容将实时同步在容器中。
|
||||
|
||||
若需要再次运行签到脚本,可手动重启容器。每次运行Docker容器后,容器内将自动按照参数执行签到活动,签到完成后容器将自动停止运行。
|
||||
|
||||
```
|
||||
docker restart ${docker_name} && docker logs -f ${docker_name}
|
||||
```
|
||||
|
||||
关于每日定时,用户可在容器外部设计定时触发(启动)程序,每日定时运行脚本。
|
||||
|
||||
(若有需要可自行编写相关脚本通知完成状态
|
||||
|
||||
|
||||
|
||||
## 使用的第三方库
|
||||
|
||||
requests: [github](https://github.com/psf/requests) [pypi](https://pypi.org/project/requests/)
|
||||
|
18
make-docker.sh
Normal file
18
make-docker.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
docker_name="mihoyo-bbs"
|
||||
docker stop ${docker_name}
|
||||
docker rm ${docker_name}
|
||||
echo -e "\033[5;36mOrz 旧容器(镜像)已清理\033[0m"
|
||||
|
||||
time_now=$(date "+%m%d%H")
|
||||
docker build -f Dockerfile --tag ${docker_name}:"${time_now}" .
|
||||
echo -e "\033[5;36mOrz 镜像重建完成\033[0m"
|
||||
|
||||
docker run -itd \
|
||||
--name ${docker_name} \
|
||||
--log-opt max-size=1m \
|
||||
-v $(pwd):/var/app \
|
||||
${docker_name}:"${time_now}"
|
||||
echo -e "\033[5;36mOrz 镜像启动完成\033[0m"
|
||||
docker ps -a
|
||||
docker logs ${docker_name} -f
|
Loading…
Reference in New Issue
Block a user