To deploy my Laravel framework to Docker containers on AWS, I created a CodePipeline in AWS with three basic steps:
1) Get source from Github (Output artifact = MyApp)
2) Use AWS CodeBuild (configuration below)
3) Use AWS CodeDeploy to deploy my output from CodeBuild to my Docker ECS containers. (input artifacts = MyApp-built)
My issue is step 2 (codebuild). This step runs Composer install as command and uploads the output to a S3. The output Zip on S3 has one file: appspec.yml instead of my complete framework with vendor directory. So step 3 deploys one file to my containers.
Configuration of my Codebuild:
Input artifacts = MyApp
Output artifacts = MyApp-built
Artifacts name = MyApp-built (??)
buildspec.yml:
version: 0.1
phases:
build:
commands:
- composer install
artifacts:
files:
- appspec.yml
The CodePipeline status is succeeded. Hopefully you can help me out to push the output after my composer install command to running docker containers. Below you can find some lines from the CodeBuild logfile.
[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: