anchor.diff:      rm -rf /var/lib/{apt,dpkg}/ && \
       (find /usr/share/doc -depth -type f ! -name copyright -delete || true) && \
       (find /usr/share/doc -empty -delete || true) && \
  -    rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/*
  -
  -# install python requirements
  -RUN pip install --upgrade pip && \
  +    rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/* && \
  +    pip install --upgrade pip && \
       pip install ipdb \
           ipython \
           mock \
           unittest2 \
  -        watchdog
  -
  -# install nodejs requirements
  -RUN npm update && \
  +        watchdog \
  +        && \
  +    npm update && \
       npm install --silent -g bower less clean-css uglify-js requirejs
  -
  -# add invenio user
  -RUN useradd --home-dir /home/invenio --create-home --shell /bin/bash --uid 1000 invenio
   
   
   ###############################################################################
   ## 2. Requirements (semi-stable)                                             ##
   ###############################################################################
   
  -# select proper requierments level
  +# global environment variables:
  +#  - docker specific paths for Invenio
  +#  - proper requirements level
  +#  - Python extras
  +ENV INVENIOBASE_INSTANCE_PATH="/home/invenio/instance" \
  +    INVENIOBASE_STATIC_FOLDER="/home/invenio/static" \
  +    REQUIREMENTS="devel" \
  +    REXTRAS="development,docs"
   #ENV REQUIREMENTS lowest
   #ENV REQUIREMENTS release
  -ENV REQUIREMENTS devel
  -ENV REXTRAS development,docs
   
   # add requirement files
   COPY ./requirements-devel.txt ./requirements.py ./setup.cfg ./setup.py /code/
   COPY ./invenio/version.py /code/invenio/version.py
  -WORKDIR /code
   
   # install python requirements
   # the different levels get composed from different sources
   # higher levels include all requirements of lower levels
  +# NOTE: the compilation step is not that important, because it also compiles some tests
  +#       for modules that contain syntax errors on purpose (e.g. flask-registry)
   RUN python requirements.py --extras=$REXTRAS --level=min > requirements.py.lowest.txt && \
       python requirements.py --extras=$REXTRAS --level=pypi > requirements.py.release.txt && \
       python requirements.py --extras=$REXTRAS --level=dev > requirements.py.devel.txt && \
       pip install --requirement requirements.py.$REQUIREMENTS.txt --allow-all-external && \
  -    python -O -m compileall
  +    (python -O -m compileall || true)
   
   
   ###############################################################################
  
positive.code: FROM python:2.7-slim
  MAINTAINER CERN <info@invenio-software.org>
  
  # nodejs repo
  # detects distribution and adds the right repo
  # See: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#debian-and-ubuntu-based-linux-distributions
  
negative.code: ## 4. Build (changing)                                                       ##
  ###############################################################################
  
  #  - install invenio
  #  - update Python bytecode
  #  - build translation catalog
  #  - clean up
  RUN pip install --editable .[$REXTRAS] && \
      (python -O -m compileall . || true) && \
      python setup.py compile_catalog && \
      rm -rf /tmp/* /var/tmp/* /var/lib/{cache,log}/ /root/.cache/*
  
  
  ###############################################################################
  