2.3. buildspecファイルの作成

目的

buildspecファイルを作成します。

対象

  • アプリケーションコード

パラメータ

パラメータの指定

0.1. アプリケーション用ディレクトリの指定

変数の設定:

DIR_APP="${HOME}/environment/handson-cli-repository"

パラメータの確認

変数の確認:

cat << ECHO

  # 0.1. DIR_APP:"${HOME}/environment/handson-cli-repository"
         DIR_APP="${DIR_APP}"

ECHO

実施

(タスク)

コマンド:

cat << 'EOF' > ${DIR_APP}/buildspec.yml
version: 0.2

phases:
  pre_build:
    commands:
      # Discover and run unit tests. For more information, see <https://docs.pytest.org/en/latest/goodpractices.html>
      - python setup.py pytest

artifacts:
  type: zip
  files:
    - 'template.yml'
    - 'scripts/**/*'
    - 'helloworld/**/*.py'
    - 'appspec.yml'
    - 'requirements.txt'
    - 'setup.py'
EOF

cat ${DIR_APP}/buildspec.yml

結果(例):

version: 0.2

phases:
  pre_build:
    commands:
      # Discover and run unit tests. For more information, see <https://docs.pytest.org/en/latest/goodpractices.html>
      - python setup.py pytest

artifacts:
  type: zip
  files:
    - 'template.yml'
    - 'scripts/**/*'
    - 'helloworld/**/*.py'
    - 'appspec.yml'
    - 'requirements.txt'
    - 'setup.py'

備考