forked from composer/satis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
30 lines (28 loc) · 1.12 KB
/
Copy pathbuildspec.yml
File metadata and controls
30 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
version: 0.2
env:
variables:
AWS_ACCOUNT_ID: "MUST-BE-DEFINED-IN-CODEBUILD"
AWS_DEFAULT_REGION: "MUST-BE-DEFINED-IN-CODEBUILD"
IMAGE_REPO_NAME: "MUST-BE-DEFINED-IN-CODEBUILD"
IMAGE_TAG: "MUST-BE-DEFINED-IN-CODEBUILD"
phases:
pre_build:
commands:
# Amazon ECR
- echo Logging in to Amazon ECR...
- aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
- echo changing variables like IMAGE_TAG to $IMAGE_TAG and BUILD_NUMBER to $CODEBUILD_BUILD_NUMBER
- sed -i "s/AWS_ACCOUNT_ID/$AWS_ACCOUNT_ID/g; s/AWS_DEFAULT_REGION/$AWS_DEFAULT_REGION/g; s/IMAGE_REPO_NAME/$IMAGE_REPO_NAME/g; s/IMAGE_TAG/$IMAGE_TAG/g; s/BUILD_NUMBER/$CODEBUILD_BUILD_NUMBER/g" .docker/aws/Dockerecs.aws.json
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker-compose build fpm
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image on AWS ECR
- docker-compose push fpm
artifacts:
files:
- '.docker/aws/Dockerecs.aws.json'