Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我写了一个Dockerfile,以及相关的依赖和文档 #326

Open
HairlessVillager opened this issue Apr 16, 2024 · 0 comments
Open

我写了一个Dockerfile,以及相关的依赖和文档 #326

HairlessVillager opened this issue Apr 16, 2024 · 0 comments

Comments

@HairlessVillager
Copy link

$ git diff requirements.txt

diff --git a/requirements.txt b/requirements.txt
index 45efc5f..5338b6c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,5 @@
+cryptography==36.0.2
+pyOpenSSL==22.0.0
 Scrapy==2.5.1
+Twisted==22.10.0
 python_dateutil
\ No newline at end of file

Dockerfile

FROM python:3.11.8-slim-bullseye

ENV PYTHONFAULTHANDLER=1 \
    PYTHONUNBUFFERED=1 \
    PYTHONHASHSEED=random \
    PIP_NO_CACHE_DIR=off \
    PIP_DISABLE_PIP_VERSION_CHECK=on \
    PIP_DEFAULT_TIMEOUT=30 \
    DockerHOME=/weibospider

WORKDIR $DockerHOME
COPY . $DockerHOME

RUN pip install -r requirements.txt -i https://mirrors.cloud.tencent.com/pypi/simple

ENTRYPOINT python weibospider/run_spider.py tweet_by_keyword

Note 注意 cookie.txt需要移动到LICENSE的同级目录。

  • Build 构建镜像:docker build -t weibospider .
  • Run 运行镜像:docker run -itd weibospider
  • Log 查看日志:docker logs <这里填写容器的ID>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant