From 571d74d6d49884ec0291e2af595e364e8b72b6d5 Mon Sep 17 00:00:00 2001 From: kev Date: Fri, 29 May 2015 08:39:22 +0800 Subject: [PATCH] add scrapyd-onbuild --- scrapyd-onbuild/Dockerfile | 58 ++++++++++++++++++++++++++++++++ scrapyd-onbuild/README.md | 5 +++ scrapyd-onbuild/packages.txt | 1 + scrapyd-onbuild/requirements.txt | 1 + scrapyd-onbuild/scrapyd.conf | 26 ++++++++++++++ 5 files changed, 91 insertions(+) create mode 100644 scrapyd-onbuild/Dockerfile create mode 100644 scrapyd-onbuild/README.md create mode 100644 scrapyd-onbuild/packages.txt create mode 100644 scrapyd-onbuild/requirements.txt create mode 100644 scrapyd-onbuild/scrapyd.conf diff --git a/scrapyd-onbuild/Dockerfile b/scrapyd-onbuild/Dockerfile new file mode 100644 index 0000000..ed92bcd --- /dev/null +++ b/scrapyd-onbuild/Dockerfile @@ -0,0 +1,58 @@ +# +# Dockerfile for scrapyd-onbuild +# + +FROM debian:jessie +MAINTAINER kev + +RUN apt-get update \ + && apt-get install -y autoconf \ + build-essential \ + curl \ + git \ + libffi-dev \ + libssl-dev \ + libtool \ + python \ + python-dev \ + vim-tiny \ + && mkdir libxml2 \ + && curl -sSL ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz | tar xz --strip 1 -C libxml2 \ + && cd libxml2 \ + && ./configure --prefix=/usr \ + && make \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -rf libxml2 \ + && mkdir libxslt \ + && curl -sSL https://git.gnome.org/browse/libxslt/snapshot/libxslt-1.1.28.tar.xz | tar xJ --strip 1 -C libxslt \ + && cd libxslt \ + && ./autogen.sh --prefix=/usr \ + && make \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -rf libxslt \ + && curl -sSL https://bootstrap.pypa.io/get-pip.py | python \ + && pip install scrapy==0.24.6 scrapyd==1.0.1 \ + && curl -sSL https://github.com/scrapy/scrapy/raw/master/extras/scrapy_bash_completion -o /etc/bash_completion.d/scrapy_bash_completion \ + && echo 'source /etc/bash_completion.d/scrapy_bash_completion' >> /root/.bashrc \ + && apt-get remove -y autoconf \ + build-essential \ + libffi-dev \ + libssl-dev \ + libtool \ + python-dev \ + && apt-get autoremove -y + +ADD ./scrapyd.conf /etc/scrapyd/ +VOLUME /etc/scrapyd/ /var/lib/scrapyd/ +EXPOSE 6800 + +ONBUILD ADD ./packages.txt /etc/scrapyd/ +ONBUILD RUN cat /etc/scrapyd/packages.txt | xargs apt-get install -y +ONBUILD ADD ./requirements.txt /etc/scrapyd/ +ONBUILD RUN pip install -r /etc/scrapyd/requirements.txt + +CMD ["scrapyd"] diff --git a/scrapyd-onbuild/README.md b/scrapyd-onbuild/README.md new file mode 100644 index 0000000..e508a47 --- /dev/null +++ b/scrapyd-onbuild/README.md @@ -0,0 +1,5 @@ +scrapyd-onbuild +=============== + +Dockerfile for building an image that runs [scrapyd][1]. + diff --git a/scrapyd-onbuild/packages.txt b/scrapyd-onbuild/packages.txt new file mode 100644 index 0000000..6eb8678 --- /dev/null +++ b/scrapyd-onbuild/packages.txt @@ -0,0 +1 @@ +libpq-dev diff --git a/scrapyd-onbuild/requirements.txt b/scrapyd-onbuild/requirements.txt new file mode 100644 index 0000000..658130b --- /dev/null +++ b/scrapyd-onbuild/requirements.txt @@ -0,0 +1 @@ +psycopg2 diff --git a/scrapyd-onbuild/scrapyd.conf b/scrapyd-onbuild/scrapyd.conf new file mode 100644 index 0000000..77f31f5 --- /dev/null +++ b/scrapyd-onbuild/scrapyd.conf @@ -0,0 +1,26 @@ +[scrapyd] +eggs_dir = /var/lib/scrapyd/eggs +logs_dir = /var/lib/scrapyd/logs +items_dir = /var/lib/scrapyd/items +dbs_dir = /var/lib/scrapyd/dbs +jobs_to_keep = 5 +max_proc = 0 +max_proc_per_cpu = 4 +finished_to_keep = 100 +poll_interval = 5 +http_port = 6800 +debug = off +runner = scrapyd.runner +application = scrapyd.app.application +launcher = scrapyd.launcher.Launcher + +[services] +schedule.json = scrapyd.webservice.Schedule +cancel.json = scrapyd.webservice.Cancel +addversion.json = scrapyd.webservice.AddVersion +listprojects.json = scrapyd.webservice.ListProjects +listversions.json = scrapyd.webservice.ListVersions +listspiders.json = scrapyd.webservice.ListSpiders +delproject.json = scrapyd.webservice.DeleteProject +delversion.json = scrapyd.webservice.DeleteVersion +listjobs.json = scrapyd.webservice.ListJobs