This article has been archived. Please see Coder Docs for the updated version.
If your environment contains an executable ~/personalize
file, Coder Enterprise will call it whenever it creates or rebuilds your environment.
For example, if you want to use htop in your development workflow, but the base image doesn't include it, you can create a ~/personalize
file that installs it for you:
#!/bin/bash
sudo apt-get install -y htop
The personalize script can be as simple or as complex as you'd like. The following is a more in-depth example:
#!/bin/bash
###########################################################################
# For use with an environment build using an image that includes git. This
# script configures git using Coder's personalize script. This script runs
# each time the environment is rebuilt. The script must be located at
# ~/personalize. The initial environment will not contain this script, so
# it must be added after creation.
###########################################################################
# Backup existing git config if it exists
if [ -f ~/.gitconfig ]; then
echo "Backing up ~/.gitconfig"
mv ~/.gitconfig ~/.gitconfig.bak
fi
# Set name and email in git
echo "[user]\n\temail = youremailhere@gmail.com\n\tname = Your Name" > ~/.gitconfig
The personalize script must be executable; if you create your own script, you may need to run chmod +x ~/personalize
to give the script execute permissions
Please note that when you create a new personalize file or edit an existing file, your changes won't take effect until you either:
- Run
~/personalize
using the Coder Enterprise terminal - Rebuild your environment
Comments
0 comments
Please sign in to leave a comment.