FAQ—Building Environment
Last updated
Was this helpful?
Last updated
Was this helpful?
Sometimes you will need software that isn't currently available through a package manager, or which needs a precisely specified order of operations. For these use cases, use the postInstall script. Here, you can run any commands that you could run on a Linux system (e.g., curl
, unzip
/tar
, or git clone
). It will be available underneath the package managers in the Environment screen.
Because the script will be run as part of the build phase, any commands will be run once, and will then be cached as part of your capsule's custom environment.
A few things to note:
Many software installation instructions will specify commands such as sudo apt-get install python-dev
; sudo
is neither necessary nor available on Code Ocean and can simply be omitted.
postInstall script cannot access /code
or /data
folders.
Referring folder built in the postInstall script:
The working directory for the postInstall script is /
(root), which means if you include a command like mkdir mylibrary
to create a folder, when you later need to refer to that folder, it'll be available at /mylibrary
.
The/opt
folder can be accessed from postInstall script and reproducible runs. Therefore, you can use /opt
folder to keep source or downloaded files and configure the package. Then add /opt
to the path and use the package in a reproducible run.