anchor.diff:                       libxslt=1.1.32 \
                        graphviz=2.40.1 \
                        traits=4.6.0 \
  -                     # Make sure zlib is installed
  -                     zlib; sync &&  \
  +                     zlib; sync && \
       chmod -R a+rX /usr/local/miniconda; sync && \
       chmod +x /usr/local/miniconda/bin/*; sync && \
       conda clean --all -y; sync && \
  
positive.code: RUN python -c "from matplotlib import font_manager" && \
      sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
  
  # Installing Ubuntu packages and cleaning up
  RUN apt-get update && \
      apt-get install -y --no-install-recommends \
                      git=1:2.7.4-0ubuntu1 && \
      apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  
  # Install latest pandoc
  RUN curl -o pandoc-2.2.2.1-1-amd64.deb -sSL "https://github.com/jgm/pandoc/releases/download/2.2.2.1/pandoc-2.2.2.1-1-amd64.deb" && \
      dpkg -i pandoc-2.2.2.1-1-amd64.deb && \
      rm pandoc-2.2.2.1-1-amd64.deb
  
  # Unless otherwise specified each process should only use one thread - nipype
  # will handle parallelization
  ENV MKL_NUM_THREADS=1 \
      OMP_NUM_THREADS=1
  
  WORKDIR /root/
  
  # Precaching atlases
  ENV CRN_SHARED_DATA /templateflow
  ADD docker/scripts/get_templates.sh get_templates.sh
  RUN mkdir $CRN_SHARED_DATA && \
      /root/get_templates.sh && \
      find $CRN_SHARED_DATA -type d -exec chmod 555 {} \; && \
      find $CRN_SHARED_DATA -type f -exec chmod 444 {} \; && \
      chmod +w $CRN_SHARED_DATA
  
  # Installing dev requirements (packages that are not in pypi)
  ADD requirements.txt requirements.txt
  RUN pip install -r requirements.txt && \
      rm -rf ~/.cache/pip
  
  # Installing FMRIPREP
  COPY . /root/src/fmriprep
  ARG VERSION
  # Force static versioning within container
  RUN echo "${VERSION}" > /root/src/fmriprep/fmriprep/VERSION && \
      cd /root/src/fmriprep && \
      pip install .[all] && \
      rm -rf ~/.cache/pip
  
  RUN install -m 0755 \
      /root/src/fmriprep/scripts/generate_reference_mask.py \
      /usr/local/bin/generate_reference_mask
  
  ENV IS_DOCKER_8395080871=1
  
negative.code: ARG VCS_REF
  ARG VERSION
  LABEL org.label-schema.build-date=$BUILD_DATE \
        org.label-schema.name="fMRIPrep" \
        org.label-schema.description="fMRIPrep - robust fMRI preprocessing tool" \
        org.label-schema.url="http://fMRIPrep.org" \
        org.label-schema.vcs-ref=$VCS_REF \
        org.label-schema.vcs-url="https://github.com/poldracklab/fmriprep" \
        org.label-schema.version=$VERSION \
  