`
sillycat
  • 浏览: 2551620 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Python Crawler(6)Deployment on Docker on EC2

 
阅读更多
Python Crawler(6)Deployment on Docker on EC2

The start.sh will be similar to the rasbperryPi one.

The file conf/scrapyd.conf  will be the same

The Makefile, I just change the name of the docker image
IMAGE=sillycat/public
TAG=centos7-scrapyd
NAME=centos7-scrapyd


docker-context:

build: docker-context
docker build -t $(IMAGE):$(TAG) .

run:
docker run -d -p 6800:6800 --name $(NAME) $(IMAGE):$(TAG)

debug:
docker run -ti -p 6800:6800 --name $(NAME) $(IMAGE):$(TAG) /bin/bash

clean:
docker stop ${NAME}
docker rm ${NAME}

logs:
docker logs ${NAME}

publish:
docker push ${IMAGE}:${TAG}

fetch:
docker pull ${IMAGE}:${TAG}

Dockerfile will be the major difference parts.
#Prepre the OS
FROM centos:7
MAINTAINER Carl Luo <luohuazju@gmail.com>

#install the softwarea
RUN yum -y update
RUN yum install -y gcc
RUN yum install -y python-devel

#install pip
RUN mkdir -p /install/
WORKDIR /install/
RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
RUN python get-pip.py

#install scrapyd
RUN pip install scrapyd

#copy the config
RUN mkdir -p /tool/scrapyd/
ADD conf/scrapyd.conf /tool/scrapyd/

#set up the app
EXPOSE  6800
RUN     mkdir -p /app/
ADD     start.sh /app/
WORKDIR /app/
CMD[ "./start.sh" ]


References:
http://sillycat.iteye.com/blog/2394767


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics