feat:docker volume
This commit is contained in:
parent
5a19b9980e
commit
9718d58b45
16
Dockerfile
16
Dockerfile
@ -1,8 +1,12 @@
|
||||
FROM python:3.8-slim
|
||||
|
||||
WORKDIR /app
|
||||
ARG APP_WORKDIR=/tv
|
||||
|
||||
COPY . /app
|
||||
ENV APP_WORKDIR=$APP_WORKDIR
|
||||
|
||||
COPY . $APP_WORKDIR
|
||||
|
||||
WORKDIR $APP_WORKDIR
|
||||
|
||||
RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv
|
||||
|
||||
@ -17,12 +21,12 @@ ARG INSTALL_CHROMIUM=false
|
||||
|
||||
RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then apt-get install -y chromium chromium-driver cron; fi
|
||||
|
||||
RUN (crontab -l 2>/dev/null; echo "0 22 * * * cd /app && pipenv run python main.py scheduled_task") | crontab -
|
||||
RUN (crontab -l 2>/dev/null; echo "0 7 * * * pipenv run python $APP_WORKDIR/main.py scheduled_task"; echo "0 8 * * * pipenv run python $APP_WORKDIR/main.py scheduled_task") | crontab -
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
COPY entrypoint.sh /tv_entrypoint.sh
|
||||
|
||||
RUN chmod +x /entrypoint.sh
|
||||
RUN chmod +x /tv_entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
ENTRYPOINT /tv_entrypoint.sh
|
22
README.md
22
README.md
@ -66,24 +66,22 @@ pipenv run ui
|
||||
|
||||
```bash
|
||||
1. 拉取镜像:
|
||||
|
||||
requests版本:
|
||||
requests:
|
||||
docker pull guovern/tv-requests:latest
|
||||
|
||||
driver版本:
|
||||
driver:
|
||||
docker pull guovern/tv-driver:latest
|
||||
|
||||
2. 运行容器:docker run --name tv-requests或driver -d -p 8000:8000 guovern/tv-requests或driver
|
||||
2. 运行容器:
|
||||
docker run -d -p 8000:8000 guovern/tv-requests 或 tv-driver
|
||||
|
||||
卷挂载参数(可选):
|
||||
-v 宿主机路径/TV:/tv-requests 或 tv-driver
|
||||
|
||||
实现宿主机文件与容器文件同步,修改模板、配置、获取更新结果文件可直接在宿主机文件夹下操作
|
||||
注:使用此命令运行容器,请务必先clone本项目至宿主机
|
||||
|
||||
3. 查看更新结果:访问(域名:8000)
|
||||
|
||||
4. 自定义(可选):
|
||||
|
||||
- 修改模板:
|
||||
docker cp 系统路径/user-demo.txt tv-requests或driver:/app/user-demo.txt
|
||||
|
||||
- 修改配置:
|
||||
docker cp 系统路径/user-config.py tv-requests或driver:/app/user-config.py
|
||||
```
|
||||
|
||||
#### 注:方式一至三更新完成后的结果文件链接:http://本地 ip:8000
|
||||
|
18
README_en.md
18
README_en.md
@ -66,24 +66,22 @@ It's recommended to try each one and choose the version that suits you. If you c
|
||||
|
||||
```bash
|
||||
1. Pull the image:
|
||||
|
||||
For requests version:
|
||||
docker pull guovern/tv-requests:latest
|
||||
|
||||
For driver version:
|
||||
docker pull guovern/tv-driver:latest
|
||||
|
||||
2. Run the container: docker run --name tv-requests or driver -d -p 8000:8000 guovern/tv-requests or driver
|
||||
2. Run the container:
|
||||
docker run -d -p 8000:8000 guovern/tv-requests or driver
|
||||
|
||||
Volume Mount Parameter (Optional):
|
||||
-v host path/TV:/tv-requests or tv-driver
|
||||
|
||||
This allows synchronization of files between the host machine and the container. Modifying templates, configurations, and retrieving updated result files can be directly operated in the host machine's folder.
|
||||
Note: Before running the container with this command, be sure to first clone this project to the host machine.
|
||||
|
||||
3. Check the update results: Visit (domain:8000)
|
||||
|
||||
4. Customization (optional):
|
||||
|
||||
- Modify the template:
|
||||
docker cp your_system_path/user-demo.txt tv-requests or driver:/app/user-demo.txt
|
||||
|
||||
- Modify the configuration:
|
||||
docker cp your_system_path/user-config.py tv-requests or driver:/app/user-config.py
|
||||
```
|
||||
|
||||
#### Note: Link to the result file after updates of methods one to three: http://local ip:8000
|
||||
|
@ -92,24 +92,22 @@ pipenv run ui
|
||||
|
||||
```bash
|
||||
1. 拉取镜像:
|
||||
|
||||
requests版本:
|
||||
requests:
|
||||
docker pull guovern/tv-requests:latest
|
||||
|
||||
driver版本:
|
||||
driver:
|
||||
docker pull guovern/tv-driver:latest
|
||||
|
||||
2. 运行容器:docker run --name tv-requests或driver -d -p 8000:8000 guovern/tv-requests或driver
|
||||
2. 运行容器:
|
||||
docker run -d -p 8000:8000 guovern/tv-requests 或 tv-driver
|
||||
|
||||
卷挂载参数(可选):
|
||||
-v 宿主机路径/TV:/tv-requests 或 tv-driver
|
||||
|
||||
实现宿主机文件与容器文件同步,修改模板、配置、获取更新结果文件可直接在宿主机文件夹下操作
|
||||
注:使用此命令运行容器,请务必先clone本项目至宿主机
|
||||
|
||||
3. 查看更新结果:访问(域名:8000)
|
||||
|
||||
4. 自定义(可选):
|
||||
|
||||
- 修改模板:
|
||||
docker cp 系统路径/user-demo.txt tv-requests或driver:/app/user-demo.txt
|
||||
|
||||
- 修改配置:
|
||||
docker cp 系统路径/user-config.py tv-requests或driver:/app/user-config.py
|
||||
```
|
||||
|
||||
#### 注:方式一至三更新完成后的结果文件链接:http://本地 ip:8000
|
||||
|
@ -92,24 +92,22 @@ pipenv run ui
|
||||
|
||||
```bash
|
||||
1. Pull the image:
|
||||
|
||||
For requests version:
|
||||
docker pull guovern/tv-requests:latest
|
||||
|
||||
For driver version:
|
||||
docker pull guovern/tv-driver:latest
|
||||
|
||||
2. Run the container: docker run --name tv-requests or driver -d -p 8000:8000 guovern/tv-requests or driver
|
||||
2. Run the container:
|
||||
docker run -d -p 8000:8000 guovern/tv-requests or driver
|
||||
|
||||
Volume Mount Parameter (Optional):
|
||||
-v host path/TV:/tv-requests or tv-driver
|
||||
|
||||
This allows synchronization of files between the host machine and the container. Modifying templates, configurations, and retrieving updated result files can be directly operated in the host machine's folder.
|
||||
Note: Before running the container with this command, be sure to first clone this project to the host machine.
|
||||
|
||||
3. Check the update results: Visit (domain:8000)
|
||||
|
||||
4. Customization (optional):
|
||||
|
||||
- Modify the template:
|
||||
docker cp your_system_path/user-demo.txt tv-requests or driver:/app/user-demo.txt
|
||||
|
||||
- Modify the configuration:
|
||||
docker cp your_system_path/user-config.py tv-requests or driver:/app/user-config.py
|
||||
```
|
||||
|
||||
#### Note: Link to the result file after updates of methods one to three: http://local ip:8000
|
||||
|
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
pipenv run python /app/main.py scheduled_task
|
||||
pipenv run python $APP_WORKDIR/main.py scheduled_task
|
||||
|
||||
service cron start
|
||||
|
||||
pipenv run gunicorn -b :8000 main:app
|
||||
service cron start
|
Loading…
x
Reference in New Issue
Block a user