content: FROM ghcr.io/fcp-indi/c-pac/ubuntu:xenial-20200114 as ANTs
  USER root
  
  # install ANTs from Neurodocker
  ENV LANG="en_US.UTF-8" \
      LC_ALL="en_US.UTF-8" \
      ANTSPATH="/usr/lib/ants/" \
      PATH="/usr/lib/ants:$PATH"
  
  RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
      && dpkg-reconfigure --frontend=noninteractive locales \
      && update-locale LANG="en_US.UTF-8" \
      && chmod 777 /opt && chmod a+s /opt
  
  RUN echo "Downloading ANTs ..." \
      && mkdir -p /usr/lib/ants \
      && curl -fsSL --retry 5 https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz \
      | tar -xz -C /usr/lib/ants --strip-components 1
  
  # download OASIS templates for niworkflows-ants skullstripping
  RUN mkdir /ants_template && \
      curl -sL https://s3-eu-west-1.amazonaws.com/pfigshare-u-files/3133832/Oasis.zip -o /tmp/Oasis.zip && \
      unzip /tmp/Oasis.zip -d /tmp &&\
      mv /tmp/MICCAI2012-Multi-Atlas-Challenge-Data /ants_template/oasis && \
      rm -rf /tmp/Oasis.zip /tmp/MICCAI2012-Multi-Atlas-Challenge-Data
  
  ENTRYPOINT ["/bin/bash"]
  
  # Link libraries for Singularity images
  RUN ldconfig
  
  RUN apt-get clean && \
      apt-get autoremove -y && \
      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  
  # Only keep what we need
  FROM scratch
  LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A STAGE IMAGE IN A MULTI-STAGE BUILD \
  ANTs 2.3.4 stage"
  LABEL org.opencontainers.image.source https://github.com/FCP-INDI/C-PAC
  COPY --from=ANTs /usr/lib/ants/ /usr/lib/ants/
  COPY --from=ANTs /ants_template /ants_template
  COPY --from=ANTS /etc/locale.gen /etc/locale.gen
  