Во-первых, фаза build
не имеет правильного отступа, поэтому команды BUILD никогда не выполнялись.
Кроме того, CodeBuild не принимает dist/
в качестве допустимого пути к файлу.Вы можете обновить файлы артефактов до dist/**/*
(Справка: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-syntax, вы можете найти действительные синтаксисы файлов в разделе artifacts
)
Мне удалось построить с этим YAML:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- echo Installing angular cli...
- npm install -g @angular/cli
- yarn add @angular-devkit/build-angular --dev
build:
commands:
- echo Build started...
- ng build --prod
artifacts:
files:
- dist/**/*
Журнал сборки (обратите внимание на эту строку [Container] 2019/06/29 03:54:46 BUILD: 2 commands
):
[Container] 2019/06/29 03:54:43 Waiting for agent ping
[Container] 2019/06/29 03:54:45 Waiting for DOWNLOAD_SOURCE
[Container] 2019/06/29 03:54:46 Phase is DOWNLOAD_SOURCE
[Container] 2019/06/29 03:54:46 CODEBUILD_SRC_DIR=/codebuild/output/src432990035/src/github.com/taoyong-ty/CodeBuildAngularJS
[Container] 2019/06/29 03:54:46 YAML location is /codebuild/readonly/buildspec.yml
[Container] 2019/06/29 03:54:46 Processing environment variables
[Container] 2019/06/29 03:54:46 Moving to directory /codebuild/output/src432990035/src/github.com/taoyong-ty/CodeBuildAngularJS
[Container] 2019/06/29 03:54:46 Registering with agent
[Container] 2019/06/29 03:54:46 Phases found in YAML: 2
[Container] 2019/06/29 03:54:46 INSTALL: 3 commands
[Container] 2019/06/29 03:54:46 BUILD: 2 commands
[Container] 2019/06/29 03:54:46 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2019/06/29 03:54:46 Phase context status code: Message:
[Container] 2019/06/29 03:54:46 Entering phase INSTALL
[Container] 2019/06/29 03:54:46 Running command echo "Installing Node.js version 10 ..."
Installing Node.js version 10 ...
[Container] 2019/06/29 03:54:46 Running command n 10.16.0
[Container] 2019/06/29 03:54:50 Running command echo Installing angular cli...
Installing angular cli...
[Container] 2019/06/29 03:54:50 Running command npm install -g @angular/cli
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
> @angular/cli@8.0.6 postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js
+ @angular/cli@8.0.6
added 228 packages from 175 contributors in 8.003s
[Container] 2019/06/29 03:55:00 Running command yarn add @angular-devkit/build-angular --dev
...
[Container] 2019/06/29 03:55:27 Phase complete: INSTALL State: SUCCEEDED
[Container] 2019/06/29 03:55:27 Phase context status code: Message:
[Container] 2019/06/29 03:55:27 Entering phase PRE_BUILD
[Container] 2019/06/29 03:55:27 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2019/06/29 03:55:27 Phase context status code: Message:
[Container] 2019/06/29 03:55:27 Entering phase BUILD
[Container] 2019/06/29 03:55:27 Running command echo Build started...
Build started...
[Container] 2019/06/29 03:55:27 Running command ng build --prod
Date: 2019-06-29T03:55:53.941Z
Hash: 1c706bd9139214c9249a
Time: 23138ms
chunk {0} runtime-es5.741402d1d47331ce975c.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main-es5.e3ebb85443beec4e9e43.js (main) 242 kB [initial] [rendered]
chunk {2} polyfills-es5.3c7a89c465e3c36435bf.js (polyfills) 111 kB [initial] [rendered]
Date: 2019-06-29T03:56:11.506Z
Hash: 6942a0134cd3414197f9
Time: 17532ms
chunk {0} runtime-es2015.858f8dd898b75fe86926.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main-es2015.0e84a207334269c68b86.js (main) 209 kB [initial] [rendered]
chunk {2} polyfills-es2015.5728f680576ca47e99fe.js (polyfills) 36.4 kB [initial] [rendered]
chunk {3} styles.3ff695c00d717f2d2a11.css (styles) 0 bytes [initial] [rendered]
[Container] 2019/06/29 03:56:11 Phase complete: BUILD State: SUCCEEDED
[Container] 2019/06/29 03:56:11 Phase context status code: Message:
[Container] 2019/06/29 03:56:11 Entering phase POST_BUILD
[Container] 2019/06/29 03:56:11 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2019/06/29 03:56:11 Phase context status code: Message:
[Container] 2019/06/29 03:56:11 Expanding base directory path: .
[Container] 2019/06/29 03:56:11 Assembling file list
[Container] 2019/06/29 03:56:11 Expanding .
[Container] 2019/06/29 03:56:11 Expanding artifact file paths for base directory .
[Container] 2019/06/29 03:56:11 Assembling file list
[Container] 2019/06/29 03:56:11 Expanding dist/**/*
[Container] 2019/06/29 03:56:11 Found 10 file(s)
[Container] 2019/06/29 03:56:11 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2019/06/29 03:56:11 Phase context status code: Message: