如何在Elastic Beanstalk上添加PATH

时间:2015-12-09 12:10:40

标签: amazon-web-services elastic-beanstalk

我想将PATH添加到eb deploy上的包中。 软件包已安装到/var/www/html/vendor/bin

可以通过SSH手动添加,但如何使用配置文件添加PATH。

我有这样的配置文件.ebextensions/ec2.config01-set_timezone工作正常02-set_path dosen't

commands:
  01-set_timezone:
    command: cp /usr/share/zoneinfo/Japan /etc/localtime
  02-set_path:
    command: export PATH=$PATH:/var/www/html/vendor/bin

1 个答案:

答案 0 :(得分:8)

每个命令都在自己的shell中执行。所以出口不会起作用。您需要将其放入~/.bash_profile以确保它在每个新命令中执行。

commands:
  set_path:
    test: test ! -f /opt/elasticbeanstalk/.post-provisioning-complete
    command: echo 'export PATH=$PATH:/var/www/html/vendor/bin' >> /root/.bash_profile

使其仅运行一次,添加以下文件:

.ebextensions / 99_finalize_setup.config:

commands:
  99_write_post_provisioning_complete_file:
    command: touch /opt/elasticbeanstalk/.post-provisioning-complete
相关问题