AWS CodePipeline 输出文件为空

AWS CodePipeline 输出文件为空

为了将我的 Laravel 框架部署到 AWS 上的 Docker 容器,我在 AWS 中创建了一个 CodePipeline,包含三个基本步骤:

1)从 Github 获取源代码(输出工件 = MyApp)
2)使用 AWS CodeBuild(配置如下)
3)使用 AWS CodeDeploy 将我的输出从 CodeBuild 部署到我的 Docker ECS 容器。(输入工件 = MyApp-built)

我的问题是步骤 2(codebuild)。此步骤以命令形式运行 Composer install 并将输出上传到 S3。S3 上的输出 Zip 有一个文件:appspec.yml,而不是带有供应商目录的完整框架。因此,步骤 3 将一个文件部署到我的容器中。

我的 Codebuild 的配置:
输入工件 = MyApp
输出工件 = MyApp-built
工件名称 = MyApp-built (??)

构建规范.yml:

version: 0.1

phases:
  build:
    commands:
      - composer install

 artifacts:
  files:
    - appspec.yml

CodePipeline 状态为成功。希望您能帮助我将 composer install 命令后的输出推送到正在运行的 docker 容器。下面您可以找到 CodeBuild 日志文件中的几行。

[Container] 2017/03/23 20:41:18 Waiting for agent
[Container] 2017/03/23 20:41:18 Phase is DOWNLOAD_SOURCE
[Container] 2017/03/23 20:41:18 Source is located at /tmp/src931942067/src
[Container] 2017/03/23 20:41:18 YAML location is /codebuild/readonly/buildspec.yml
[Container] 2017/03/23 20:41:18 Registering with agent
[Container] 2017/03/23 20:41:18 Phases found in YAML: 1
[Container] 2017/03/23 20:41:18 BUILD: 1 commands
[Container] 2017/03/23 20:41:18 Phase complete: DOWNLOAD_SOURCE Success: true
[Container] 2017/03/23 20:41:18 Phase context status code: Message:
[Container] 2017/03/23 20:41:18 Processing plaintext environment variables
[Container] 2017/03/23 20:41:18 Processing build-level environment variables
[Container] 2017/03/23 20:41:18
{
    "base-directory:": "/",
    "discard-paths": "yes"
}

[Container] 2017/03/23 20:41:18 base-directory: = /
[Container] 2017/03/23 20:41:18 discard-paths = yes
[Container] 2017/03/23 20:41:18 Processing builtin environment variables
[Container] 2017/03/23 20:41:18 Moving to directory /tmp/src931942067/src
[Container] 2017/03/23 20:41:18 Entering phase BUILD
[Container] 2017/03/23 20:41:18 Running command composer install
[Container] 2017/03/23 20:41:19 Loading composer repositories with package information
....
....
[Container] 2017/03/23 20:42:25 > php artisan optimize
[Container] 2017/03/23 20:42:26 Generating optimized class loader
[Container] 2017/03/23 20:42:26 The compiled services file has been removed.
[Container] 2017/03/23 20:42:26 Phase complete: BUILD Success: true
[Container] 2017/03/23 20:42:26 Phase context status code: Message:
[Container] 2017/03/23 20:42:26 Preparing to copy artifacts
[Container] 2017/03/23 20:42:26 Expanding base directory path
[Container] 2017/03/23 20:42:26 Assembling file list
[Container] 2017/03/23 20:42:26 Expanding .
[Container] 2017/03/23 20:42:26 Found .
[Container] 2017/03/23 20:42:26 Expanding artifact file paths for base directory .
[Container] 2017/03/23 20:42:26 Assembling file list
[Container] 2017/03/23 20:42:26 Expanding appspec.yml
[Container] 2017/03/23 20:42:26 Found appspec.yml
[Container] 2017/03/23 20:42:26 Creating zip artifact
[Container] 2017/03/23 20:42:26 Phase complete: UPLOAD_ARTIFACTS Success: true
[Container] 2017/03/23 20:42:26 Phase context status code: Message: 

答案1

要上传项目中的所有文件,请使用以下格式:

artifacts:
   files:
     - '**/*'

相关内容