Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for compiling FreeSurfer from source #445

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
997931e
[WIP] working in freesurfer from source
pwighton Feb 26, 2021
2bc36ec
[WIP] trying to port mcr template
pwighton Feb 26, 2021
2122231
[WIP] env vars for fs from source
pwighton Feb 26, 2021
e04b2ca
[WIP] tweaks
pwighton Feb 26, 2021
e389f8c
[WIP] up to `make install`
pwighton Mar 2, 2021
2dad8b5
[WIP] having issues with git annex
pwighton Mar 4, 2021
c35aa7f
[WIP] working verison?
pwighton Mar 4, 2021
0bebb04
[FIX] tweaks
pwighton Mar 4, 2021
63d1bb8
[WIP] this builds fs
pwighton Mar 4, 2021
ca16170
[WIP] a lot more params
pwighton Mar 4, 2021
c181b65
[FIX] tweaks
pwighton Mar 4, 2021
db108aa
[WIP] working on infant stream from source
pwighton Mar 5, 2021
57bfc55
[FIX] installs python reqs
pwighton Apr 27, 2021
716ffeb
[FIX] typo
pwighton Apr 27, 2021
e764a3a
[WIP] aws buildspec
pwighton May 3, 2021
080f7ed
[WIP] fix
pwighton May 3, 2021
8044d6e
[WIP] fix
pwighton May 3, 2021
10a81b5
[FIX] wrap around martinos specific niftireg install
pwighton May 7, 2021
40fad5e
[FIX] var rename
pwighton May 7, 2021
071f480
[WIP] adding unzip
pwighton May 7, 2021
a5625b4
[FIX] upgrating fs python env to 3.6.8
pwighton May 11, 2021
7c029d8
[GIT] manual merge
pwighton May 13, 2021
943679f
[WIP] install python env for non infant stream
pwighton May 13, 2021
5a3f2e5
[WIP] re-arrange cause git annex is slow
pwighton May 13, 2021
ecc824f
[WIP] debug echos
pwighton May 13, 2021
294f31e
[FIX] bash bugfix
pwighton May 20, 2021
efcea8c
[WIP]
pwighton May 20, 2021
c6f5fd3
[WIP] syntax
pwighton May 20, 2021
16a2378
[FIX] to support samseg vis
pwighton May 26, 2021
05701e1
[WIP] to support samseg atlas building utils
pwighton Jun 8, 2021
b572b5b
[WIP] re-arrange
pwighton Jun 8, 2021
955b927
[WIP] samseg atlas utils
pwighton Jun 8, 2021
3922ff7
[FIX] unlocking git annex before `make install`
pwighton Jun 15, 2021
216af34
[WIP] using -DGEMS_BUILD_EXECUTABLES to build samseg atlas tools
pwighton Jun 23, 2021
8d6abc0
[WIP] test..
pwighton Jun 23, 2021
19d4678
[FIX] moving default fs pkg dir, so /tmp can safely be removed
pwighton Jul 2, 2021
6d672ba
[FIX] adds pythonpath env var for fs packages
pwighton Jul 7, 2021
72a9c8c
[WIP] the beginnings of dev options
pwighton Jul 13, 2021
358f9d8
[FIX] fs path stomp fix
pwighton Jul 13, 2021
04d1a8a
[FIX] path stomp bug take 2: electric boogaloo
pwighton Jul 13, 2021
3a1d539
[WIP] tweaks for jupyter
pwighton Aug 11, 2021
1a87d27
Merge branch 'master' into 20210513-fs-source-and-infant-merge
pwighton Aug 11, 2021
e728e7a
[WIP] prereqs for jupyter
pwighton Aug 13, 2021
ba3eb99
[WIP] New Params
pwighton Aug 13, 2021
396248c
[WIP] refactor to use jinja conditionals
pwighton Aug 25, 2021
aeac0d0
[FIX] syntax
pwighton Aug 26, 2021
244e913
[WIP] test
pwighton Aug 26, 2021
38fdf90
[WIP] debug
pwighton Aug 26, 2021
e7a2113
[WIP] adding license stuff back
pwighton Aug 27, 2021
d0005e9
[FIX]
pwighton Aug 31, 2021
a352ac2
[FIX] formatting
pwighton Sep 8, 2021
510a9e7
[FIX] formatting
pwighton Sep 8, 2021
5236bfd
[WIP] syntax text
pwighton Sep 8, 2021
4b57ea8
[WIP] test
pwighton Sep 8, 2021
0ea929f
[WIP] test
pwighton Sep 8, 2021
21fa66a
[FIX] wip
pwighton Sep 8, 2021
a44107e
[FIX] wip
pwighton Sep 8, 2021
79b02f6
[WIP] adding awscli as a dev tool (prolly not the best palce)
pwighton Sep 9, 2021
319d14b
[WIP] updating mni envs
pwighton Sep 10, 2021
bb0d615
[WIP] adding the ability to select indv commit
pwighton Sep 22, 2021
ed37f87
[FIX] dropping --single-branch from git clone
pwighton Sep 22, 2021
7f17fa1
[WIP] test..
pwighton Sep 23, 2021
e5fc06e
[WIP] full test
pwighton Sep 23, 2021
e412c5c
[WIP] syntax test
pwighton Sep 23, 2021
c8b87cf
[FIX] adding back matlabmcr
pwighton Sep 24, 2021
93f689e
[FIX] applying @kaczmarj's diff
pwighton Oct 15, 2021
00c665a
[FIX] merging matlabmcr
pwighton Oct 15, 2021
e174eb5
[WIP] infant tensorflow fix
pwighton Oct 16, 2021
9939378
[WIP] not installing extra reqs with dev tools
pwighton Oct 18, 2021
6f1aa33
[WIP] tweaks for singularity
pwighton Nov 5, 2021
da4c72a
[FIX] moving from /tmp to /stage for singularity
pwighton Nov 16, 2021
94e704f
[WIP] changing fs source dir to /stage and symlinking infant aws entr…
pwighton Nov 17, 2021
7e0885a
[WIP] merging in support for fs720
pwighton Nov 23, 2021
9da3823
[WIP] trying to support deb and rpm installations
pwighton Feb 15, 2022
84636a3
[DOC]
pwighton Feb 15, 2022
300796f
[WIP] infant model inside container
pwighton Mar 28, 2022
cda0118
[WIP] copying the infant model into the container, but not by default
pwighton Mar 29, 2022
f2721cc
[FIX] syntax tweak
pwighton Apr 8, 2022
95055e0
[WIP] syntax tweak
pwighton Apr 8, 2022
a9071f9
[WIP] syntax tweak
pwighton Apr 8, 2022
7eabc6d
[FIX] syntax
pwighton Apr 11, 2022
632b11e
[WIP]
pwighton Apr 12, 2022
669fbaf
[WIP]
pwighton Apr 12, 2022
68dc87a
[FIX] defining SSCNN_MODEL_DIR
pwighton Apr 13, 2022
ca592a3
[FIX] defining SSCNN_MODEL_DIR
pwighton Apr 13, 2022
a05eef7
[ENH] making `branch` optional
pwighton Apr 14, 2022
fccfac4
Merge branch 'master' into 20220414-fs-source
pwighton Apr 14, 2022
12d0f21
[GIT] removing buildspec before PR
pwighton Apr 14, 2022
1fd938c
[FIX] remove whitespace
pwighton Jun 9, 2022
368b2f7
[WIP] adding back buildspec
pwighton Jun 9, 2022
e6a2af8
[WIP] syntax tweak to support commit param
pwighton Jun 9, 2022
2900180
[GIT] removing buildspec before pushing upstream
pwighton Jun 9, 2022
730aff3
[WIP] updating fs python to 3.6.8
pwighton Jun 10, 2022
2625184
[FIX] fix for issue #449
pwighton Aug 3, 2022
5ae1a83
Merge branch 'master' of github.com:ReproNim/neurodocker
pwighton Aug 22, 2022
8f94055
Merge pull request #1 from ReproNim/master
Oct 21, 2023
cfc0060
Bringing Freesurfer-from-source up to date with master branch
Oct 21, 2023
3f586d0
Merge pull request #1 from Alafia-Ai/20220414-fs-source
pwighton Oct 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 290 additions & 11 deletions neurodocker/templates/freesurfer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- version
optional:
install_path: /opt/freesurfer-{{ self.version }}
license_base64: ""
license_path: "/opt"
license_file: license.txt
exclude_paths: |
average/mult-comp-cor
lib/cuda
Expand All @@ -26,6 +29,10 @@
"7.3.2": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-linux-centos7_x86_64-7.3.2.tar.gz
"7.3.1": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.1/freesurfer-linux-centos7_x86_64-7.3.1.tar.gz
"7.3.0": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.0/freesurfer-linux-centos7_x86_64-7.3.0.tar.gz
"7.2.0-centos6": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0/freesurfer-CentOS6-7.2.0-1.x86_64.rpm
"7.2.0-centos7": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0/freesurfer-CentOS7-7.2.0-1.x86_64.rpm
"7.2.0-centos8": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0/freesurfer-CentOS8-7.2.0-1.x86_64.rpm
"7.2.0-deb": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0/freesurfer_7.2.0_amd64.deb
"7.2.0": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0/freesurfer-linux-centos6_x86_64-7.2.0.tar.gz
"7.1.1": https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.1.1/freesurfer-linux-centos6_x86_64-7.1.1.tar.gz
"7.1.1-min": https://dl.dropbox.com/s/c3earkfhhvdyuo4/freesurfer-7.1.1-min.tgz
Expand Down Expand Up @@ -69,7 +76,7 @@
# default freesurfer options
FS_OVERRIDE: "0"
FIX_VERTEX_AREA: ""
FSF_OUTPUT_FORMAT: "nii.gz# mni env requirements"
FSF_OUTPUT_FORMAT: "nii.gz"
# mni environment requirements
MINC_BIN_DIR: "{{ self.install_path }}/mni/bin"
MINC_LIB_DIR: "{{ self.install_path }}/mni/lib"
Expand All @@ -79,15 +86,287 @@
PERL5LIB: "{{ self.install_path }}/mni/share/perl5"
instructions: |
{{ self.install_dependencies() }}
echo "Downloading FreeSurfer ..."
mkdir -p {{ self.install_path }}
curl -fL {{ self.urls[self.version] }} \
| tar -xz -C {{ self.install_path }} --owner root --group root --no-same-owner --strip-components 1 {% if self.exclude_paths -%}\
{%- for exclude_path in self.exclude_paths.split() %}
{% if not loop.last -%}
--exclude='{{ exclude_path }}' \
{%- if self.version in ["6.0.0-min", "6.0.0", "6.0.1", "7.1.0", "7.1.1-min", "7.1.1", "7.2.0"] %}
echo "Downloading FreeSurfer ..."
mkdir -p {{ self.install_path }}
curl -fL {{ self.urls[self.version] }} \
| tar -xz -C {{ self.install_path }} --owner root --group root --no-same-owner --strip-components 1 {% if self.exclude_paths -%}\
{%- for exclude_path in self.exclude_paths.split() %}
{% if not loop.last -%}
--exclude='{{ exclude_path }}' \
{%- else -%}
--exclude='{{ exclude_path }}'
{%- endif -%}
{%- endfor %}
{%- endif %}
{%- else -%}
{%- if self.version in ["deb"] %}
apt-get update -qq
apt-get install --fix-missing -y \
apt-file apt-utils apt-transport-https dpkg-dev debhelper devscripts librpm-dev rpm
curl -o /stage/freesurfer_amd64.deb {{ self.urls[self.version] }}
dpkg -i /stage/freesurfer_amd64.deb
DEBIAN_FRONTEND=noninteractive apt-get -f -y install
apt-get clean
rm -rf /var/lib/apt/lists/*
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/'
{%- else -%}
--exclude='{{ exclude_path }}'
# todo: wip
yum -y update --exclude=filesystem*
yum -y install dnf-plugins-core epel-release
yum -y config-manager --set-enabled powertools
yum -y update --exclude=filesystem*
{%- endif -%}
{%- endfor %}
{%- endif %}
echo "{{ self.pkg_manager }}"
{%- endif -%}

source:
arguments:
optional:
repo: https://github.com/freesurfer/freesurfer
branch: "dev"
commit: ""
license_base64: ""
license_path: "/opt"
license_file: license.txt
# The subject dir is not in /opt, like everything else FreeSurfer-related
# Because if we want to run `neurodocker minify` we want to operate over the `/opt`
# dir and have the subjects dir excluded
subjects_dir: "/ext/fs-subjects"
infant_model_dir: "/opt/fs-infant-model"
infant_model_s3: ""
infant_model_s3_region: ""
pkg_url: http://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/centos7-packages.tar.gz
annex: https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/repo/annex.git
# set to niftyreg.yaml default
niftyreg_path: /opt/niftyreg-master
minimal: "ON"
build_guis: "OFF"
infant_module: "OFF"
install_python_deps: "OFF"
distribute_fspython: "OFF"
martinos_build: "OFF"
samseg_atlas_build: "OFF"
git_annex_get: "ON"
dev_tools: "OFF"
fortran_libs: /usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.so
# --- Probably don't have to change args below here ---
# Were using a source path of `/stage` instead of `/temp` in case we want to
# keep the source dir around for debugging (dev_tools=ON) with singularity containers
# (which bind mount the `/tmp` dir by default)
source_path: /stage/freesurfer/freesurfer-{{ self.branch }}
pkg_path: /opt/freesurfer-pkg
install_path: /opt/freesurfer-{{ self.branch }}
cxx_flags: "-msse2 -mfpmath=sse -fPIC -fpermissive"
c_flags: "-msse2 -mfpmath=sse -fPIC"
cmake_opts: -DCMAKE_INSTALL_PREFIX={{ self.install_path }} -DBUILD_GUIS={{ self.build_guis }} -DMINIMAL={{ self.minimal }} -DINFANT_MODULE={{ self.infant_module }} -DFS_PACKAGES_DIR={{ self.pkg_path }} -DGFORTRAN_LIBRARIES={{ self.fortran_libs }} -DINSTALL_PYTHON_DEPENDENCIES={{ self.install_python_deps }} -DDISTRIBUTE_FSPYTHON={{ self.distribute_fspython }} -DMARTINOS_BUILD={{ self.martinos_build }} -DGEMS_BUILD_EXECUTABLES={{ self.samseg_atlas_build }} -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_CXX_COMPILER_AR=/usr/bin/ar -DCMAKE_CXX_COMPILER_RANLIB=/usr/bin/ranlib -DCMAKE_CXX_FLAGS="{{ self.cxx_flags }}" -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_C_COMPILER_AR=/usr/bin/ar -DCMAKE_C_COMPILER_RANLIB=/usr/bin/ranlib -DCMAKE_C_FLAGS="{{ self.c_flags }}"
make_opts: -j4
env:
FS_LICENSE: "{{ self.license_path }}/{{ self.license_file }}"
SUBJECTS_DIR: "{{ self.subjects_dir }}"
FS_INFANT_MODEL: "{{ self.infant_model_dir }}"
SSCNN_MODEL_DIR: "{{ self.infant_model_dir }}/sscnn_skullstrip"
# From https://github.com/freesurfer/freesurfer/blob/54018f7d6f620d6288b28f50e14a0a4ba421757c/Dockerfile#L20-L42
OS: "Linux"
PATH: "{{ self.niftyreg_path }}/bin:{{ self.pkg_path }}/mni/current/bin:{{ self.install_path }}/bin:{{ self.install_path }}/fsfast/bin:{{ self.install_path }}/tktools:{{ self.install_path }}/mni/bin:$PATH"
FREESURFER_HOME: "{{ self.install_path }}"
FREESURFER: "{{ self.install_path }}"
PERL5LIB: "{{ self.install_path }}/mni/share/perl5"
LOCAL_DIR: "{{ self.install_path }}/local"
FSFAST_HOME: "{{ self.install_path }}/fsfast"
FMRI_ANALYSIS_DIR: "{{ self.install_path }}/fsfast"
FSF_OUTPUT_FORMAT: "nii.gz"
FUNCTIONALS_DIR: "{{ self.install_path }}/sessions"
PYTHONPATH: "{{ self.install_path }}/python/packages"
# default freesurfer options
FS_OVERRIDE: "0"
FIX_VERTEX_AREA: ""
# To supress a `Could not set locale` error when `mri_convert` is run in recon-all

Check failure on line 184 in neurodocker/templates/freesurfer.yaml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

supress ==> suppress
FS_DISABLE_LANG: "1"
# Just in case: https://github.com/freesurfer/freesurfer/issues/776
FS_TIME_ALLOW: "0"
# mni environment requirements
MINC_BIN_DIR: "{{ self.pkg_path }}/mni/current/bin"
MINC_LIB_DIR: "{{ self.pkg_path }}/mni/current/lib"
MNI_DIR: "{{ self.pkg_path }}/mni"
MNI_DATAPATH: "{{ self.pkg_path }}/mni/current/data"
MNI_PERL5LIB: "{{ self.pkg_path }}/mni/current/share/perl5"
PERL5LIB: "{{ self.pkg_path }}/mni/current/share/perl5"
# infant model setup, see:
# - https://github.com/pwighton/fs-docker/blob/f691232312e97f2ea87b8ae45bfd5c365e2bc91c/baby/dockerfile#L85
# - https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/infant/freesurfer-linux-centos7_x86_64-infant.tar.gz
# This temporary and should migrate somewhere else
CNYBCH_TEMPLATE_SUBJECTS_DIR: "{{ self.infant_model_dir }}/CNYBCH"
CNYBCH_SUBJECTS: "Template1 Template2 Template3 Template4 Template5 Template6 Template7 Template8 Template9 Template10 Template11 Template12 Template13 Template14 Template15 Template16 Template17 Template18 Template19 Template20 Template21 Template22 Template23 Template24 Template25 Template26"
# age at MRI scan (mo)
CNYBCH_AGES: "9 7 6 5 18 12 0 0 3 8 10 10 18 4 2 14 3 16 0 12 0 15 5 17 16 0"
CNYBCH_GMWM_SUBJECTS: "Template5 Template6 Template8 Template10 Template13 Template18 Template20 Template22"
# mo
CNYBCH_GMWM_AGES: "18 12 0 8 18 16 12 15"
CNYBCH_NEONATES: "Template7 Template8 Template19 Template21 Template26"
# days (first two computed from weeks)
CNYBCH_NEONATEAGES: "3 4 1 2 4"
CNYBCH_AROUNDONE: "Template11 Template12 Template6 Template20 Template16"
#mo
CNYBCH_AROUNDONEAGES: "10 10 12 12 14"
dependencies:
apt:
- ca-certificates
- cmake
- git
- git-annex
- make
- bc
- binutils
- bzip2
- coreutils
- curl
- g++-4.8
- gcc-4.8-base
- gcc-4.8
- gfortran-4.8
- libbz2-dev
- libfreetype6-dev
- libgfortran-4.8-dev
- libglib2.0-0
- libglu1-mesa-dev
- libgomp1
- libjpeg62-dev
- libopenblas-dev
- libssl-dev
- libsqlite3-dev
- libtool
- libtool-bin
- libx11-dev
- libxaw7-dev
- libxi-dev
- libxml2-utils
- libxmu-dev
- libxmu-headers
- libxmu6
- libxt-dev
- libxt6
- perl
- sudo
- tar
- tcsh
- unzip
- uuid-dev
- vim-common
- wget
yum:
- ca-certificates
- cmake
- gcc-c++
- git
- make
instructions: |
{{ self.install_dependencies() }}
{%- if self.license_base64 is defined and self.license_base64|length %}
echo " fs license (base64): "{{ self.license_base64 }}
mkdir -p {{ self.license_path }}
echo {{ self.license_base64 }} | base64 -d > {{ self.license_path }}/{{ self.license_file }}
{% endif -%}
# git config
# -------------------------------------------------------------------------
git config --global user.email "CI@example.com"
git config --global user.name "CI"
# Switch to gcc 4.8
# -------------------------------------------------------------------------
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 100
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-4.8 100
# Make a staging directory, we don't want to use /tmp since it doesn't play nice with singularity
# See: https://github.com/ReproNim/neurodocker/issues/246
# -------------------------------------------------------------------------
mkdir -p /stage
# Python v3.8.9
# -------------------------------------------------------------------------
curl -sSL --retry 5 https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz | tar -xz -C /stage
cd /stage/Python-3.8.9
./configure
make
make install
cd /
rm -rf /stage/Python-3.8.9
pip3 install -q --no-cache-dir -U pip
pip3 install -q --no-cache-dir wheel
sync
# Cmake v3.19.0 (must be > v3.6.8)
# -------------------------------------------------------------------------
wget https://github.com/Kitware/CMake/releases/download/v3.19.0/cmake-3.19.0-Linux-x86_64.sh -q -O /stage/cmake-install.sh
chmod u+x /stage/cmake-install.sh
mkdir -p /usr/share/cmake-3.19.0
/stage/cmake-install.sh --skip-license --prefix=/usr/share/cmake-3.19.0
CMAKE_BINPATH=`which cmake`
rm -rf $CMAKE_BINPATH
ln -s /usr/share/cmake-3.19.0/bin/cmake $CMAKE_BINPATH
rm /stage/cmake-install.sh
# Compile FreeSurfer
# ----------------------------------------------------------------
mkdir -p {{ self.pkg_path }}
mkdir -p {{ self.install_path }}
wget -q -c {{ self.pkg_url }} -O - | tar -xz -C {{ self.pkg_path }}
mv {{ self.pkg_path }}/packages/* {{ self.pkg_path }}
rm -rf {{ self.pkg_path }}/packages
echo "Cloning..."
echo " remote: "{{ self.repo }}
echo " branch: "{{ self.branch }}
echo " commit: "{{ self.commit }}
echo " destination: "{{ self.source_path }}
git clone --branch {{ self.branch }} {{ self.repo }} {{ self.source_path }}
{%- if self.commit is defined and self.commit|length %}
cd {{ self.source_path }}
git checkout {{ self.commit }}
{% endif -%}
cd {{ self.install_path }}
cmake {{ self.cmake_opts }} {{ self.source_path }}
make {{ self.make_opts }}
# Install python reqs
# ----------------------------------------------------------------
{%- if self.infant_module.lower() in ["on", "true", "1", "y"] %}
pip3 install -r {{ self.source_path }}/infant/docker/requirements.txt
ln -s {{ self.install_path }}/bin/infant-container-entrypoint.bash /bin/infant-container-entrypoint.bash
ln -s {{ self.install_path }}/bin/infant-container-entrypoint-aws.bash /bin/infant-container-entrypoint-aws.bash
{% else %}
pip3 install -r {{ self.source_path }}/python/requirements.txt
{% endif -%}
# Setup annex remote
# ----------------------------------------------------------------
cd {{ self.source_path }}
git remote add datasrc {{ self.annex }}
git fetch datasrc
git annex enableremote datasrc || true
# Pull from annex and install
# (`make install` will fail if `git annex get` isn't run)
# ----------------------------------------------------------------
{%- if self.git_annex_get.lower() in ["on", "true", "1", "y"] %}
cd {{ self.source_path }}
git annex get -q .
git annex unlock
cd {{ self.install_path }}
make install
{% endif -%}
# Setup mount points
# ----------------------------------------------------------------
mkdir -p {{ self.subjects_dir }}
mkdir -p {{ self.infant_model_dir }}
# Dev tools
# - jupyter relies on `libsqlite3-dev` being present before python is compiled
# - the /stage dir isn't deleted (to facilitate recompile/install/test)
# - awscli is installed (todo, best place for this?)
# ----------------------------------------------------------------
{%- if self.dev_tools.lower() in ["on", "true", "1", "y"] %}
pip3 install jupyter
cd /stage
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
rm -rf /stage/aws
rm -rf /stage/awscliv2.zip
{%- if self.infant_model_s3 is defined and self.infant_model_s3|length and self.infant_model_s3_region is defined and self.infant_model_s3_region|length %}
aws s3 cp --no-sign-request --region={{ self.infant_model_s3_region }} --recursive --include '*' {{ self.infant_model_s3 }} {{ self.infant_model_dir }}/
{% endif %}
{% else %}
rm -rf /stage
{% endif -%}
Loading