Skip to content

Instantly share code, notes, and snippets.

@codinronan
Forked from cooperka/01_install_yarn.config
Created February 9, 2020 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codinronan/d8766920fe850484685eb445d9ce45b3 to your computer and use it in GitHub Desktop.
Save codinronan/d8766920fe850484685eb445d9ce45b3 to your computer and use it in GitHub Desktop.
AWS Elastic Beanstalk - Replace npm with yarn
# .ebextensions/01_install_yarn.config
files:
'/opt/elasticbeanstalk/hooks/appdeploy/pre/49install_yarn.sh' :
mode: '000755'
owner: root
group: root
content: |
#!/usr/bin/env bash
set -euxo pipefail
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
if node -v; then
echo 'Node already installed.'
else
echo 'Installing node...'
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
yum -y install nodejs
fi
if yarn -v; then
echo 'Yarn already installed.'
else
echo 'Installing yarn...'
wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
yum -y install yarn
fi
'/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh' :
mode: '000755'
owner: root
group: root
content: |
#!/usr/bin/env bash
set -euxo pipefail
yarn install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment