![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
コンピューティングの状況が進化し続けるにつれて、多様なコンピューティングアーキテクチャをサポートすることに重点が置かれています。
This blog was authored by Zakiya Randall, Technical Account Manager and co-written with Muru Bhaskaran, Sr. Specialist Solutions Architect.
このブログは、テクニカルアカウントマネージャーであるZakiya Randallが執筆し、Muru Bhaskaran、Sr。Specialist Solutions Architectと共同執筆しました。
As the landscape of computing continues to evolve, there is a growing emphasis on supporting a diverse range of computing architectures. This shift is driven by the need for flexibility, efficiency, and performance optimization across different hardware platforms. Consequently, it has become increasingly important for developers and organizations to build container images that are compatible with multiple architectures (multi-arch).
コンピューティングの状況が進化し続けるにつれて、多様なコンピューティングアーキテクチャをサポートすることに重点が置かれています。このシフトは、さまざまなハードウェアプラットフォーム全体で柔軟性、効率、パフォーマンスの最適化の必要性によって促進されます。その結果、開発者や組織が複数のアーキテクチャ(マルチアーチ)と互換性のあるコンテナ画像を構築することがますます重要になっています。
AWS CodeBuild is a fully managed continuous integration service that now supports managed GitHub Actions runners, which are self-hosted runners that allow users to configure their CodeBuild projects to receive GitHub Actions workflow job events. In this post, we demonstrate a solution that uses GitHub, GitHub Actions workflows, and CodeBuild to build native container images for both x86 and AWS Graviton-based compute on AWS. Upon completion of our GitHub Actions workflow, we will proceed to push our multi-arch images to Amazon Elastic Container Registry (Amazon ECR).
AWS CodeBuildは、マネージドGithub Actionsランナーをサポートする完全に管理された継続的な統合サービスであり、ユーザーがGitHub Actions Workflow Jobイベントを受信するようにコードビルドプロジェクトを構成できる自己ホストランナーです。この投稿では、Github、Github Actions Workflows、およびCodeBuildを使用して、AWS上のX86およびAWS Gravitonベースのコンピューティングの両方のネイティブコンテナ画像を構築するソリューションを示します。 GitHubアクションワークフローが完了すると、マルチアーチ画像をAmazon Elastic Container Registry(Amazon ECR)にプッシュします。
Solution overview
解決策の概要
The architecture diagram illustrates the workflow that occurs upon committing a change to the GitHub repository, detailing the subsequent steps involved in pushing the container image to Amazon ECR.
アーキテクチャ図は、GitHubリポジトリの変更を犯したときに発生するワークフローを示しており、コンテナ画像をAmazon ECRに押し込むことに伴う後続の手順を詳述しています。
Figure 1: Solution architecture diagram
図1:ソリューションアーキテクチャ図
Prerequisites
前提条件
The following prerequisites are necessary to complete this solution:
このソリューションを完了するには、次の前提条件が必要です。
Walkthrough
ウォークスルー
The following steps walk you through this solution.
次の手順では、このソリューションをご覧ください。
Creating GitHub repository files
GitHubリポジトリファイルの作成
To begin creating the solution, you need a GitHub repository to store the Dockerfile, index.html file, and GitHub Actions workflow YAML file. Refer to Creating a new GitHub repository for step by step instructions. For this example, the following files should be committed to the root of the GitHub repository.
ソリューションの作成を開始するには、dockerfile、index.htmlファイル、およびgithubアクションワークフローyamlファイルを保存するためのgithubリポジトリが必要です。段階的な指示のために新しいGitHubリポジトリの作成を参照してください。この例では、次のファイルをGitHubリポジトリのルートにコミットする必要があります。
Create two CodeBuild projects for the x86 and arm64 compute architectures
X86およびARM64コンピューティングアーキテクチャの2つのCodeBuildプロジェクトを作成します
You must create two CodeBuild projects to run your GitHub Actions jobs. Your CodeBuild projects should follow the following naming structure for
GitHubアクションジョブを実行するには、2つのCodeBuildプロジェクトを作成する必要があります。 CodeBuildプロジェクトは、-X86および-ARM64の次の命名構造に従う必要があります。 X86およびARM64計算環境の2つのCodeBuildプロジェクトを設定するには、次のチュートリアルを参照してください。 OAUTHアプリ認証方法を使用して、GitHubリポジトリに接続する必要があります。 X86およびARM64 CodeBuildプロジェクトの場合、各計算アーキテクチャに一致するサポートされている環境画像を選択します。 BuildSpecビルド仕様は無視されます。代わりに、CodeBuildは、Computeランナーをセットアップするコマンドを使用するようにオーバーライドします。
Figure 2: CodeBuild Projects for x86 and arm64
図2:X86およびARM64のCodeBuildプロジェクト
Create an Amazon ECR repository
Amazon ECRリポジトリを作成します
You also need to create an Amazon ECR repository to store the x86 and arm64 container images. Run the following AWS CLI command to create an Amazon ECR repository.
また、X86およびARM64コンテナ画像を保存するには、Amazon ECRリポジトリを作成する必要があります。次のAWS CLIコマンドを実行して、Amazon ECRリポジトリを作成します。
After creating and defining your Amazon ECR repository, you must define a role so that the CodeBuild runners can have permission to access and push your images to your Amazon ECR repository. The following role that you create allows you to push images to your Amazon ECR repository.
Amazon ECRリポジトリを作成および定義した後、CodeBuildランナーがAmazon ECRリポジトリにアクセスしてプッシュする許可を得ることができるように、役割を定義する必要があります。次の役割を作成すると、Amazon ECRリポジトリに画像をプッシュできます。
After creating the policy, go to the AWS Identity and Access Management (IAM) console to create an Identity Provider and choose OpenID Connect. For the Provider URL, choose https://token.actions.githubusercontent.com. For the Audience, choose sts.amazonaws.com.
ポリシーを作成した後、AWS IDおよびAccess Management(IAM)コンソールに移動してIDプロバイダーを作成し、OpenID Connectを選択します。プロバイダーURLの場合、https://token.actions.githubusercontent.comを選択します。聴衆のために、sts.amazonaws.comを選択してください。
2. After you create the provider, create a role and choose Web Identity. In the drop-down box, you should see the Provider URL for https://token.actions.githubusercontent.com. Choose this option and specify sts.amazonaws.com for your Audience. In the GitHub organization, specify your GitHub Organization and add the repository that you created in the initial setup. Choose Next.
2。プロバイダーを作成したら、役割を作成し、Web IDを選択します。ドロップダウンボックスには、https://token.actions.githubusercontent.comのプロバイダーURLが表示されます。このオプションを選択し、視聴者にsts.amazonaws.comを指定します。 GitHub組織で、GitHub組織を指定し、最初のセットアップで作成したリポジトリを追加します。次を選択してください。
Figure 3: Example of creating the role
図3:役割の作成例
3. On the Add Permissions page, choose the policy that you created in Step 1 so that you can push images to Amazon ECR. Choose Next. On the next screen, name the role and choose Create role.
3. [アクセス許可]ページで、ステップ1で作成したポリシーを選択して、Amazon ECRに画像をプッシュできるようにします。次を選択してください。次の画面で、役割に名前を付けて、[作成]を選択します。
Figure 4: Example of adding policy permissions
図4:ポリシー許可の追加例
4. Go to Settings within your GitHub repository, and under Security in the left pane, choose Secrets and Variables. Choose the Actions tab within Secrets and Variables. Choose New repository secret. For the name, enter AWS_ROLE_ARN, enter the AWS Role ARN of the role that you created in Step 3, and choose Add secret.
4. githubリポジトリ内の設定に移動し、左ペインのセキュリティの下で、秘密と変数を選択します。秘密と変数内の[アクション]タブを選択します。新しいリポジトリシークレットを選択してください。名前については、AWS_ROLE_ARNを入力し、ステップ3で作成した役割のAWSロールARNを入力し、Secretの追加を選択します。
Figure 5: Example of creating GitHub Actions secret for the AWS Role
図5:AWSの役割の秘密のgithubアクションを作成する例
5. Create another New repository secret for AWS_REGION. Specify the Region in which you created your resources and choose Add secret.
5. AWS_REGIONの別の新しいリポジトリシークレットを作成します。リソースを作成した地域を指定し、Secretの追加を選択します。
Figure 6: Example of GitHub Actions secret for the AWS Region
図6:AWS地域の秘密のgithubアクションの例
Prepare GitHub Actions workflow
GitHubアクションワークフローを準備します
A GitHub Actions workflow is a configurable automated process made up of one or more jobs and you can define these jobs in a YAML file. You are going to create a YAML file in the .github/workflows directory within your GitHub repository that defines the workflow for the solution. The YAML file for your GitHub Actions workflow contains the build
GitHubアクションワークフローは、1つ以上のジョブで構成される構成可能な自動プロセスであり、YAMLファイルでこれらのジョブを定義できます。ソリューションのワークフローを定義するgithubリポジトリ内の.github/workflowsディレクトリにyamlファイルを作成します。 githubアクション用のyamlファイルには、ビルドが含まれています
免責事項:info@kdj.com
提供される情報は取引に関するアドバイスではありません。 kdj.com は、この記事で提供される情報に基づいて行われた投資に対して一切の責任を負いません。暗号通貨は変動性が高いため、十分な調査を行った上で慎重に投資することを強くお勧めします。
このウェブサイトで使用されているコンテンツが著作権を侵害していると思われる場合は、直ちに当社 (info@kdj.com) までご連絡ください。速やかに削除させていただきます。
-
-
-
-
-
- SolanaとXRPは、市場の不確実性の中で苦労しています
- 2025-03-17 21:25:57
- 低料金で大規模な取引量を管理するSolanaの能力は、以前のブルランで成功するのに役立ちました。
-
-
-
-