version: 0.2

env:
  variables:
    ENVNAME: dev
  git-credential-helper: yes

phases:
  install:
    runtime-versions:
      python: 3.8
    commands:
      - pip --version || curl -s https://bootstrap.pypa.io/get-pip.py | python
      - git config --global user.email build@lambda-my-aws.io
      - git config --global user.name codebuild
      - pip install git+https://github.com/lambda-my-aws/ecs_composex@master#egg-info=ecs-composex


  pre_build:
    commands:
      - ecs_composex --help
      - mkdir outputs

  build:
    commands:
      - ecs_composex --create-vpc --create-cluster --single-nat --bucket-name ${CFN_TPL_BUCKET} -f compose.yml -o outputs/composex_dev.yml
      - ecs_composex --bucket-name ${CFN_TPL_BUCKET} -f compose.yml -o outputs/composex_prod.yml

artifacts:
  files:
    - '*'
  base-directory: outputs
