diff --git a/.gitignore b/.gitignore index b75d241..1f372c8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ venv __pycache__ env.py env.slave.py -env.docker.py \ No newline at end of file +env.docker.py +docker-compose.yml \ No newline at end of file diff --git a/README.md b/README.md index 77c89b7..f340895 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ python main.py ## Docker 使用 -**1. 将配置文件下载到本地*** +**1. 将配置文件下载到本地** ```bash docker run --rm pjialin/py12306 cat /config/env.py > env.py # 或 @@ -100,6 +100,19 @@ docker run --rm --name py12306 -p 8008:8008 -d -v $(pwd):/config -v py12306:/dat ``` 当前目录会多一个 12306.log 的日志文件, `tail -f 12306.log` +### Docker-compose 中使用 +**1. 复制配置文件** +``` +cp docker-compose.yml.example docker-compose.yml +``` + +**2. 从 docker-compose 运行** + +在`docker-compose.yml`所在的目录使用命令 +``` +docker-compose up -d +``` + ## Web 管理页面 目前支持用户和任务以及实时日志查看,更多功能后续会不断加入 diff --git a/docker-compose.yml.example b/docker-compose.yml.example new file mode 100644 index 0000000..6813067 --- /dev/null +++ b/docker-compose.yml.example @@ -0,0 +1,12 @@ +version: "2" +services: + py12306: + build: . + volumes: + - ./env.py:/config/env.py + - py12306:/data + ports: + - 8008:8008 + +volumes: + py12306: diff --git a/requirements.txt b/requirements.txt index 140e89b..2f2ad1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +-i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com appdirs==1.4.3 beautifulsoup4==4.7.0 bs4==0.0.1