Last active
October 30, 2018 18:57
-
-
Save gssbzn/54f1f8036dfd29a89629078152972dff to your computer and use it in GitHub Desktop.
Elastic Beanstalk Rails+Webpacker extension
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
# Copyright 2018 SwiftComply.com | |
commands: | |
01_node_install: | |
test: "[ `node --version` != 'v8.10.0' ]" | |
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -" | |
02_yarn_repo: | |
test: "[ ! -f /etc/yum.repos.d/yarn.repo ]" | |
command: "curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo" | |
03_yarn_install: | |
test: "[ ! -x /usr/bin/yarn ]" | |
command: "yum install -y yarn" | |
files: | |
# If this file is edited, it must be removed from EC2 instance prior to deploy. | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh" : | |
mode: "00555" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
#============================================================================== | |
# Copyright 2018 SwiftComply.com | |
# | |
# This file is distributed on | |
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or | |
# implied. | |
#============================================================================== | |
. /opt/elasticbeanstalk/hooks/common.sh | |
set -xe | |
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) | |
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir) | |
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user) | |
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir) | |
. $EB_SUPPORT_DIR/envvars | |
cd $EB_APP_STAGING_DIR | |
if [ -f package.json ]; then | |
echo "running 'yarn install' with package.json:" | |
cat package.json | |
./bin/yarn install | |
else | |
echo "no package.json found! Skipping yarn install stage!" | |
fi | |
if [ -f yarn.lock ]; then | |
echo "encountered a yarn.lock, setting proper permissions" | |
chown $EB_APP_USER:$EB_APP_USER yarn.lock | |
else | |
echo "no yarn.lock file found, so no permissions to set on it" | |
fi |
This seems to no longer work on Elastic Beanstalk instances.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how about
or