在AWS CodeBuild项目的构建规范中添加“debugOptions”配置,启用调试模式并指定调试端口。例如:
version: 0.2
phases:
install:
commands:
- apt-get update && apt-get install -y ruby-full
- apt-get install -y zip
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
- apt-get install -y nodejs
- npm install -g webpack
pre_build:
commands:
- echo Nothing to do in the pre_build phase...
build:
commands:
- echo Build started on `date`
- webpack --mode production
- aws s3 cp ./dist s3://my-bucket --recursive
post_build:
commands:
- echo Build completed on `date`
debugOptions:
enabled: true
port: 2222
在上面的示例中,我们添加了一个名为“debugOptions”的新部分,并将其设置为启用调试,端口为2222。启动AWS CodeBuild项目后,可以使用远程调试器连接到实例的2222端口,以在代码中设置断点并调试代码。