-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (41 loc) · 1.52 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM ubuntu:18.04
MAINTAINER Carlos Rosas <[email protected]>
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV LANG C.UTF-8
ENV LANGUAGE en_US.UTF-8
# OS: [dependencies]
RUN apt-get update && apt-get -y install --no-install-recommends \
python3 python3-pip python3-setuptools \
wget \
# Firefox & Geckdriver Prerequisites
unzip xvfb libxi6 libgconf-2-4 \
firefox \
# Erasing apt-get cache
&& rm -rf /var/lib/apt/lists/*
# OS: [dependencies:geckodriver]
ARG GECKODRIVER_VERSION=v0.26.0
RUN wget https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz \
&& tar xzf geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz \
&& mv geckodriver /usr/bin/geckodriver \
&& rm geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz
# OS: [User]
RUN useradd -m app
# APP: [dependencies]
COPY requirements.txt /home/app
RUN pip3 install --no-cache-dir -r /home/app/requirements.txt \
&& rm /home/app/requirements.txt
# APP: [repository]
COPY --chown=app:app tradefest_scraper /home/app
# THIS IS NOT NEEDED WHEN NOT USING THE
# VOLUME TO MAP THE SCRAPPED DATA INTO THE LOCAL MACHINE
RUN mkdir -p /home/app/output/feeds \
&& mkdir -p /home/app/output/logs \
&& mkdir -p /home/app/output/media \
&& chown -R app:app /home/app/output
#################################
### Get ready, set & Python ###
#################################
USER app
WORKDIR /home/app/tradefest_scraper
CMD ["scrapy", "crawl", "tradefest"]