From df4b4830497fddcf04f042cb02cc89a20e538fc3 Mon Sep 17 00:00:00 2001 From: eracle Date: Wed, 5 Sep 2018 19:34:40 +0200 Subject: [PATCH] fixing #6: listing only main requirements, renaming the docker folder, updating the dockerfile and using a docker volume instead of copying the project codebase --- compose/local/Dockerfile | 7 +++++++ docker-compose.yml | 5 +++-- docker_conf/prod/Dockerfile | 7 ------- requirements.txt | 31 +------------------------------ requirements/production.txt | 10 ++++++++++ 5 files changed, 21 insertions(+), 39 deletions(-) create mode 100644 compose/local/Dockerfile delete mode 100644 docker_conf/prod/Dockerfile create mode 100644 requirements/production.txt diff --git a/compose/local/Dockerfile b/compose/local/Dockerfile new file mode 100644 index 0000000..3f81381 --- /dev/null +++ b/compose/local/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.6 + +# Requirements are installed here to ensure they will be cached. +COPY ./requirements /requirements +RUN pip install -r /requirements/production.txt + +WORKDIR /app diff --git a/docker-compose.yml b/docker-compose.yml index fd1a412..161ccd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,11 +6,12 @@ services: - PYTHONUNBUFFERED=0 build: context: . - dockerfile: ./docker_conf/prod/Dockerfile + dockerfile: compose/local/Dockerfile depends_on: - selenium volumes: - - ./logs:/code/logs + - .:/app + - ./logs:/app/logs selenium: container_name: selenium image: selenium/standalone-chrome-debug diff --git a/docker_conf/prod/Dockerfile b/docker_conf/prod/Dockerfile deleted file mode 100644 index 4c5f611..0000000 --- a/docker_conf/prod/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM python:3.6 -RUN mkdir /code -RUN mkdir /config -WORKDIR /code -COPY ./requirements.txt /config/ -RUN pip install -r /config/requirements.txt -COPY ./ /code/ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index ea4d398..a97a514 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,30 +1 @@ -asn1crypto==0.24.0 -attrs==18.2.0 -Automat==0.7.0 -cffi==1.11.5 -constantly==15.1.0 -cryptography==2.3.1 -cssselect==1.0.3 -hyperlink==18.0.0 -idna==2.7 -incremental==17.5.0 -lxml==4.2.4 -parsel==1.5.0 -pluggy==0.7.1 -py==1.6.0 -pyasn1==0.4.4 -pyasn1-modules==0.2.2 -pycparser==2.18 -PyDispatcher==2.0.5 -pyOpenSSL==18.0.0 -pytest==3.7.4 -pytest-sugar==0.9.1 -queuelib==1.5.0 -Scrapy==1.5.1 -selenium==3.14.0 -service-identity==17.0.0 -six==1.11.0 -termcolor==1.1.0 -Twisted==18.7.0 -w3lib==1.19.0 -zope.interface==4.5.0 +-r requirements/production.txt \ No newline at end of file diff --git a/requirements/production.txt b/requirements/production.txt new file mode 100644 index 0000000..a9630d3 --- /dev/null +++ b/requirements/production.txt @@ -0,0 +1,10 @@ +# Scrapy +Scrapy>=1.5.1 # pyup: < 2.0 # https://github.com/scrapy/scrapy + +# Selenium +selenium>=3.14.0 # pyup: < 4.0 # https://github.com/SeleniumHQ/selenium + +# Testing +# todo: move them to a dedicated req file +pytest==3.7.4 +pytest-sugar==0.9.1