Skip to content

Commit

Permalink
feat:docker volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Guovin committed Jul 17, 2024
1 parent 5a19b99 commit 9718d58
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 50 deletions.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

3. 查看更新结果:访问(域名:8000)
2. 运行容器:
docker run -d -p 8000:8000 guovern/tv-requests 或 tv-driver

4. 自定义(可选):
卷挂载参数(可选):
-v 宿主机路径/TV:/tv-requests 或 tv-driver

- 修改模板
docker cp 系统路径/user-demo.txt tv-requests或driver:/app/user-demo.txt
实现宿主机文件与容器文件同步,修改模板、配置、获取更新结果文件可直接在宿主机文件夹下操作
注:使用此命令运行容器,请务必先clone本项目至宿主机

- 修改配置:
docker cp 系统路径/user-config.py tv-requests或driver:/app/user-config.py
3. 查看更新结果:访问(域名:8000)
```

#### 注:方式一至三更新完成后的结果文件链接:http://本地 ip:8000
Expand Down
16 changes: 7 additions & 9 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

3. Check the update results: Visit (domain:8000)
2. Run the container:
docker run -d -p 8000:8000 guovern/tv-requests or driver

4. Customization (optional):
Volume Mount Parameter (Optional):
-v host path/TV:/tv-requests or tv-driver

- Modify the template:
docker cp your_system_path/user-demo.txt tv-requests or driver:/app/user-demo.txt
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.
- Modify the configuration:
docker cp your_system_path/user-config.py tv-requests or driver:/app/user-config.py
3. Check the update results: Visit (domain:8000)
```
#### Note: Link to the result file after updates of methods one to three: http://local ip:8000
Expand Down
20 changes: 9 additions & 11 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

3. 查看更新结果:访问(域名:8000)
2. 运行容器:
docker run -d -p 8000:8000 guovern/tv-requests 或 tv-driver

4. 自定义(可选):
卷挂载参数(可选):
-v 宿主机路径/TV:/tv-requests 或 tv-driver

- 修改模板
docker cp 系统路径/user-demo.txt tv-requests或driver:/app/user-demo.txt
实现宿主机文件与容器文件同步,修改模板、配置、获取更新结果文件可直接在宿主机文件夹下操作
注:使用此命令运行容器,请务必先clone本项目至宿主机

- 修改配置:
docker cp 系统路径/user-config.py tv-requests或driver:/app/user-config.py
3. 查看更新结果:访问(域名:8000)
```

#### 注:方式一至三更新完成后的结果文件链接:http://本地 ip:8000
Expand Down
16 changes: 7 additions & 9 deletions docs/tutorial_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

3. Check the update results: Visit (domain:8000)
2. Run the container:
docker run -d -p 8000:8000 guovern/tv-requests or driver

4. Customization (optional):
Volume Mount Parameter (Optional):
-v host path/TV:/tv-requests or tv-driver

- Modify the template:
docker cp your_system_path/user-demo.txt tv-requests or driver:/app/user-demo.txt
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.
- Modify the configuration:
docker cp your_system_path/user-config.py tv-requests or driver:/app/user-config.py
3. Check the update results: Visit (domain:8000)
```
#### Note: Link to the result file after updates of methods one to three: http://local ip:8000
Expand Down
6 changes: 2 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9718d58

Please sign in to comment.