我应该如何在我的 CDK 构建脚本中使用来自 aws ECR 存储库的基于自定义 windows 的构建工具 docker 图像作为环境

How should I use my custom windows based build tools docker image from aws ECR repo as environment in my CDK build script

我正在为此创建 windows WPF 应用程序的 aws codepipeline 我已经创建了自定义 docker 图像,其中包含 VS2017 构建工具,该图像将作为构建环境来构建我所有的.Net 框架相关的应用程序。 我已经从 UI 成功创建了 aws 管道,即 aws 控制台,但我正在尝试使用打字稿为同样的事情创建 CDK 堆栈 下面是我的代码

import cdk = require('@aws-cdk/core'); 
import codecommit = require('@aws-cdk/aws-codecommit'); 
import codebuild = require('@aws-cdk/aws-codebuild'); 
import codepipeline = require('@aws-cdk/aws-codepipeline'); 
import codepipeline_actions = require('@aws-cdk/aws-codepipeline-actions'); 
import s3 = require('@aws-cdk/aws-s3'); 
import { Repository } from '@aws-cdk/aws-codecommit'; 

export class CdkClickOnceAppPipelineStack extends cdk.Stack { 
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { 
    super(scope, id, props); 

    const code = codecommit.Repository.fromRepositoryName(this, 'WPFAppRepo','WPFClickOnceApp'); 
    const cdkBuild = new codebuild.PipelineProject(this,'CdkBuild',{ 
     description: 'AWS build project for .Net WPF click once application', 
     environment: {buildImage:codebuild.WindowsBuildImage.WIN_SERVER_CORE_2016_BASE} 
    }); 

  } 
}

在此代码中,我可以将 environment 指定为 WIN_SERVER_CORE_2016_BASE,这是 aws 提供的基本图像,但我想指定我在 aws 中准备好的自定义 docker 图像ECR 存储库。

谁能帮我解决这个问题我在互联网上找不到 windows .Net 框架的文档。

你可以这样定义图像:

 const ecrRepo = awsEcr.Repository.fromRepositoryArn (this,[repo Id],'arn:aws:ecr:us-east-1:[account Id]:repository/RepoName');

const cdkBuild = new codebuild.PipelineProject(this,'CdkBuild',{ 
     description: 'AWS build project for .Net WPF click once application', 
     environment: {buildImage:codebuild.WindowsBuildImage.fromEcrRepository(ecrRepo,'latest')} 
    });

它在这里: https://docs.aws.amazon.com/cdk/api/latest/docs/aws-codebuild-readme.html