Cookie の設定を選択する

当社は、当社のサイトおよびサービスを提供するために必要な必須 Cookie および類似のツールを使用しています。当社は、パフォーマンス Cookie を使用して匿名の統計情報を収集することで、お客様が当社のサイトをどのように利用しているかを把握し、改善に役立てています。必須 Cookie は無効化できませんが、[カスタマイズ] または [拒否] をクリックしてパフォーマンス Cookie を拒否することはできます。

お客様が同意した場合、AWS および承認された第三者は、Cookie を使用して便利なサイト機能を提供したり、お客様の選択を記憶したり、関連する広告を含む関連コンテンツを表示したりします。すべての必須ではない Cookie を受け入れるか拒否するには、[受け入れる] または [拒否] をクリックしてください。より詳細な選択を行うには、[カスタマイズ] をクリックしてください。

2 つのランタイムの指定

フォーカスモード
2 つのランタイムの指定 - AWS CodeBuild

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

同じ CodeBuild ビルドプロジェクトで、複数のランタイムを指定できます。このサンプルプロジェクトでは、2 つのソースファイルを使用します。1 つは Go ランタイムを使用し、もう 1 つは Node.js ランタイムを使用します。

  1. my-source という名前のディレクトリを作成します。

  2. my-source ディレクトリ内に golang-app という名前のディレクトリを作成します。

  3. 次の内容で、hello.go というファイルを作成します。ファイルを golang-app ディレクトリ内に保存します。

    package main import "fmt" func main() { fmt.Println("hello world from golang") fmt.Println("1+1 =", 1+1) fmt.Println("7.0/3.0 =", 7.0/3.0) fmt.Println(true && false) fmt.Println(true || false) fmt.Println(!true) fmt.Println("good bye from golang") }
  4. my-source ディレクトリ内に nodejs-app という名前のディレクトリを作成します。これは golang-app ディレクトリと同じレベルにある必要があります。

  5. 次の内容で、index.js というファイルを作成します。ファイルを nodejs-app ディレクトリ内に保存します。

    console.log("hello world from nodejs"); console.log("1+1 =" + (1+1)); console.log("7.0/3.0 =" + 7.0/3.0); console.log(true && false); console.log(true || false); console.log(!true); console.log("good bye from nodejs");
  6. 次の内容で、package.json というファイルを作成します。ファイルを nodejs-app ディレクトリ内に保存します。

    { "name": "mycompany-app", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"run some tests here\"" }, "author": "", "license": "ISC" }
  7. 次の内容で、buildspec.yml というファイルを作成します。my-source および nodejs-app ディレクトリと同じレベルで、ファイルを golang-app ディレクトリに保存します。runtime-versions セクションでは、Node.js バージョン 12 および Go バージョン 1.13 ランタイムを指定します。

    version: 0.2 phases: install: runtime-versions: golang: 1.13 nodejs: 12 build: commands: - echo Building the Go code... - cd $CODEBUILD_SRC_DIR/golang-app - go build hello.go - echo Building the Node code... - cd $CODEBUILD_SRC_DIR/nodejs-app - npm run test artifacts: secondary-artifacts: golang_artifacts: base-directory: golang-app files: - hello nodejs_artifacts: base-directory: nodejs-app files: - index.js - package.json
  8. ファイル構造は次のようになります。

    my-source ├── golang-app │ └── hello.go ├── nodejs.app │ ├── index.js │ └── package.json └── buildspec.yml
  9. my-source」ディレクトリの内容を、S3 入力バケットにアップロードするか、CodeCommit、GitHub、または Bitbucket リポジトリにアップロードします。

    重要

    S3 入力バケットを使用している場合は、ディレクトリ構造とファイルを必ず ZIP ファイルに圧縮してから入力バケットにアップロードしてください。my-source を ZIP ファイルに追加しないでください。追加するのは、my-source のディレクトリとファイルのみです。

  10. https://console.aws.amazon.com/codesuite/codebuild/home で AWS CodeBuild コンソールを開きます。

  11. ビルドプロジェクトを作成します。詳細については、「ビルドプロジェクトの作成 (コンソール)」および「ビルドの実行 (コンソール)」を参照してください。これらの設定を除いて、すべての設定をデフォルト値のままにします。

    • [環境] の場合:

      • [環境イメージ] で、[Managed image (マネージド型イメージ)] を選択します。

      • [オペレーティングシステム] で、[Amazon Linux 2] を選択します。

      • [ランタイム] で、[Standard (標準)] を選択します。

      • イメージ で、aws/codebuild/amazonlinux-x86_64-standard:4.0 を選択します。

  12. [Create build project (ビルドプロジェクトの作成)] を選択します。

  13. [Start build] を選択します。

  14. [ビルド設定] でデフォルト値をそのまま使用して、[ビルドの開始] を選択します。

  15. ビルドが完了したら、[ビルドログ] タブでビルド出力を表示します。次のような出力が表示されます。Go ランタイムおよび Node.js ランタイムからの出力が表示されます。また、Go アプリケーションおよび Node.js アプリケーションからの出力も表示されます。

    [Container] Date Time Processing environment variables [Container] Date Time Selecting 'golang' runtime version '1.13' based on manual selections... [Container] Date Time Selecting 'nodejs' runtime version '12' based on manual selections... [Container] Date Time Running command echo "Installing Go version 1.13 ..." Installing Go version 1.13 ... [Container] Date Time Running command echo "Installing Node.js version 12 ..." Installing Node.js version 12 ... [Container] Date Time Running command n $NODE_12_VERSION installed : v12.20.1 (with npm 6.14.10) [Container] Date Time Moving to directory /codebuild/output/src819694850/src [Container] Date Time Registering with agent [Container] Date Time Phases found in YAML: 2 [Container] Date Time INSTALL: 0 commands [Container] Date Time BUILD: 1 commands [Container] Date Time Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED [Container] Date Time Phase context status code: Message: [Container] Date Time Entering phase INSTALL [Container] Date Time Phase complete: INSTALL State: SUCCEEDED [Container] Date Time Phase context status code: Message: [Container] Date Time Entering phase PRE_BUILD [Container] Date Time Phase complete: PRE_BUILD State: SUCCEEDED [Container] Date Time Phase context status code: Message: [Container] Date Time Entering phase BUILD [Container] Date Time Running command echo Building the Go code... Building the Go code... [Container] Date Time Running command cd $CODEBUILD_SRC_DIR/golang-app [Container] Date Time Running command go build hello.go [Container] Date Time Running command echo Building the Node code... Building the Node code... [Container] Date Time Running command cd $CODEBUILD_SRC_DIR/nodejs-app [Container] Date Time Running command npm run test > mycompany-app@1.0.0 test /codebuild/output/src924084119/src/nodejs-app > echo "run some tests here" run some tests here
プライバシーサイト規約Cookie の設定
© 2025, Amazon Web Services, Inc. or its affiliates.All rights reserved.