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 <[email protected]>
#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
Python Crawler(6)Deployment on Docker on EC2
猜你喜欢
转载自sillycat.iteye.com/blog/2394774
今日推荐
周排行