Amazon Q Developer の devfile の例 - Amazon Q Developer

Amazon Q Developer の devfile の例

次の例は、devfile 仕様に準拠し、Amazon Q での使用に適した devfile を示しています。例については、このページの最後に説明します。

devfile と Amazon Q での使用方法についての詳細は、「Amazon Q の '/dev' コマンドによって生成されたコード提案のテスト」を参照してください。

Python の例

次の例は、Python プロジェクトで使用できる devfile を示しています。

schemaVersion: 2.0.0 components: - name: dev container: image: public.ecr.aws/aws-mde/universal-image:latest commands: - id: install exec: component: dev commandLine: "pip3.11 install -r requirements.txt" - id: test exec: component: dev commandLine: "python3.11 manage.py makemigrations && python3.11 manage.py test"

Node の例

次の例は、Node.js プロジェクトで使用できる devfile を示しています。

schemaVersion: 2.0.0 components: - name: dev container: image: public.ecr.aws/aws-mde/universal-image:latest commands: - id: install exec: component: dev commandLine: "npm install" - id: build exec: component: dev commandLine: "npm run build" - id: test exec: component: dev commandLine: "npm run test"

例の説明

次の表は、前述の devfile の例の各行またはコードブロックを示しています。

行またはコードブロック 説明
schemaVersion: 2.0.0

devfile スキーマのバージョンを指定します。Amazon Q はスキーマバージョン 2.0.0 のみをサポートしています。

components:

開発環境にデプロイするコンポーネントのリスト。

- name: dev container: image: public.ecr.aws/aws-mde/universal-image:latest

パブリックの Amazon Elastic Container Registry (Amazon ECR) で利用可能な最新のユニバーサルイメージ Docker イメージを開発環境として使用することを示します。このイメージのバージョンを変更することも、イメージを独自のイメージに置き換えることもできます。詳細については、「ユニバーサルイメージの内容」を参照してください。

commands:

実行するコマンドのリスト。

- id: install|build|test exec: component: dev commandLine: "cli-instructions"

installbuild、または test コマンド。Amazon Q は、開発環境のユニバーサルイメージ (または image: で指定されている任意のイメージ) で cli-instructions の手順を実行します。cli-instructions は、プロジェクトのコンテキストによって異なります。これらのコマンドは、必要に応じて変更できます。