Zerontelli
Zerontelli

Reputation: 289

Dockerfile run scrapy crawl command in a folder

I got a scrapy spider which can be run in terminal with scrapy crawl estate in the tutorial folder.

How do I use the run command in Dockerfile to cd to the tutorial folder and run it?

My Dockerfile without the RUN cd:

FROM ubuntu:18.04
FROM python:3.6-onbuild
RUN  apt-get update &&apt-get upgrade -y&& apt-get install python-pip -y
RUN pip install --upgrade pip
RUN pip install scrapy
WORKDIR /usr/local/bin
COPY scrapy_estate/tutorial/tutorial ./
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 80

Upvotes: 3

Views: 2758

Answers (1)

Granitosaurus
Granitosaurus

Reputation: 21436

You should set up WORKDIR, ENTRYPOINT and CMD in your docker file:

WORKDIR /tutorial-crawler
ENTRYPOINT ["scrapy"]
CMD []

Then:

$ docker run -it image_name list
tutorial
$ docker run -it image_name crawl tutorial

Upvotes: 2

Related Questions