【发布时间】:2018-12-21 20:31:00
【问题描述】:
所以,我有一个Dockerfile,我想在其中保留我的scrapyd 服务器。但是,由于我使用scrapyd-deploy 来部署我的Scrapy 项目,我需要等待scrapyd 服务器运行后再部署鸡蛋。我不确定如何使用Docker 来实现这一点,因为如果我使用scrapyd 作为入口点,它会“窃取”终端并且我无法按顺序运行scrapyd-deploy。
目前,我有一些可行的方法,但这对我来说看起来真的非常“老套”,我不喜欢它。正确的做法是什么?
FROM python:3.6
SHELL [ "/bin/bash", "-c" ]
# here comes a lot of configuration, copying files, installing stuff, etc ...
# important part that I think is hacky comes at the end:
# the command below redirect scrapyd streams to /dev/null, send it to the background, deploy the eggs, than run a dummy command to keep the container alive
CMD scrapyd >& /dev/null & cd ali && scrapyd-deploy && tail -f /dev/null
有什么想法或建议吗?
【问题讨论】:
标签: docker scrapy dockerfile scrapyd