Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
add dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
dubuqingfeng committed Dec 24, 2019
1 parent cc15df2 commit 27ffd11
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/.vagrant
/scrapy.iml
*.pyc
_trial_temp*
dropin.cache
docs/build
*egg-info
.tox
venv
build
dist
.idea
htmlcov/
.coverage
.pytest_cache/
.coverage.*
.cache/

# Windows
Thumbs.db
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine:3.9

ENV RUNTIME_PACKAGES python3 libxslt libxml2 git curl
ENV BUILD_PACKAGES build-base libxslt-dev libxml2-dev libffi-dev python3-dev openssl-dev

RUN apk add --no-cache ${RUNTIME_PACKAGES} ${BUILD_PACKAGES} && \
pip3 install scrapy && \
apk del ${BUILD_PACKAGES} && \
rm -rf /root/.cache

#ADD ./scrapyd.conf /etc/scrapyd/
#VOLUME /var/lib/scrapyd/

COPY . /work/app
RUN pip3 install -r /work/app/requirements.txt
RUN /usr/bin/crontab /work/app/install/crontab.txt
CMD ["/usr/sbin/crond", "-f", "-l", "8"]
9 changes: 5 additions & 4 deletions coinincome/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
import os

BOT_NAME = 'coinincome'

Expand Down Expand Up @@ -89,7 +90,7 @@
# HTTPCACHE_IGNORE_HTTP_CODES = []
# HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'

MYSQL_HOST = "127.0.0.1"
MYSQL_DBNAME = "pool_coin_income"
MYSQL_USER = "root"
MYSQL_PASSWORD = ""
MYSQL_HOST = os.getenv('MYSQL_HOST', '127.0.0.1')
MYSQL_DBNAME = os.getenv('MYSQL_DBNAME', 'pool_coin_income')
MYSQL_USER = os.getenv('MYSQL_USER', 'root')
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', 'root')
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# at https://docs.docker.com/compose/compose-file/
version: '3.3'
services:
scrapy-pool-incomes:
container_name: scrapy-pool-income
image: dubuqingfeng/scrapy-pool-income
restart: always
environment:
MYSQL_HOST: "production"
MYSQL_DBNAME: ""
MYSQL_USER: ""
MYSQL_PASSWORD: ""
1 change: 1 addition & 0 deletions install/crontab.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/5 * * * * cd /work/app && sh /work/app/run.sh

0 comments on commit 27ffd11

Please sign in to comment.