option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: babybuddy.settings.eb
    SECRET_KEY: CHANGETOSOMETHINGRANDOM
  aws:elasticbeanstalk:container:python:staticfiles:
    '/static/': 'static/'
  aws:elasticbeanstalk:container:python:
    WSGIPath: babybuddy/wsgi.py

commands:
  01_remove_outdated_nodejs:
    cwd: /tmp
    command: 'yum remove -y nodejs npm'
  02_node_source_add:
    cwd: /tmp
    command: 'curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -'
  03_npm_install:
    cwd: /tmp
    command: 'yum -y install nodejs git gcc-c++ make'
  04_gulp_install:
    cwd: /tmp
    command: 'npm install -g gulp-cli'

container_commands:
  01_pipenv_install:
    command: 'pip install pipenv'
  02_requirments_install:
    env:
      LC_ALL: en_US.utf8
      LANG: en_US.utf8
    command: 'pipenv install --system --deploy'
  03_npm_install:
    command: 'npm install'
  04_gulp_build:
    env:
      LC_ALL: en_US.utf8
      LANG: en_US.utf8
    command: 'gulp build'
  05_collectstatic:
    command: 'python manage.py collectstatic --no-input'
  06_migrate:
    command: "python manage.py migrate"
    leader_only: true