Created
October 21, 2018 07:45
-
-
Save sofyan-ahmad/d93cc1ee8e512f624b9310b32e5ec2a9 to your computer and use it in GitHub Desktop.
AWS Elasticbeasnstalk NodeJS 10.x and Yarn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file: .ebextensions/01-yarn.config | |
commands: | |
01_create_npmrc: | |
# run this command from /tmp directory | |
cwd: /tmp | |
command: 'sudo touch /tmp/.npmrc \ | |
| sudo echo \ | |
"//registry.npmjs.org/:_authToken=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k NPM_TOKEN)" \ | |
| sudo tee /tmp/.npmrc' | |
02_remove_clean_and_install_latest_nodejs: | |
# run this command from /tmp directory | |
cwd: /tmp | |
test: '[ -f /usr/bin/node ] && echo "remove previouse node"' | |
command: 'sudo yum remove -y nodejs | sudo rm /etc/yum.repos.d/nodesource*' | |
03_node_get: | |
# run this command from /tmp directory | |
cwd: /tmp | |
# flag -y for no-interaction installation | |
command: 'sudo curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -' | |
04_node_install: | |
# run this command from /tmp directory | |
cwd: /tmp | |
command: 'sudo yum -y install nodejs' | |
05_yarn_get: | |
# run this command from /tmp directory | |
cwd: /tmp | |
# don't run the command if yarn is already installed (file /usr/bin/yarn exists) | |
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"' | |
command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo' | |
06_yarn_install: | |
# run this command from /tmp directory | |
cwd: /tmp | |
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"' | |
command: 'sudo yum -y install yarn' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment