-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuildspec.yml
39 lines (33 loc) · 1.14 KB
/
buildspec.yml
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
31
32
33
34
35
36
37
38
39
---
version: 0.2
env:
variables:
IMAGE_REPO_NAME: uneet/frontend
parameter-store:
DOCKER_USERNAME: DOCKER_USERNAME
DOCKER_PASSWORD: DOCKER_PASSWORD
phases:
pre_build:
commands:
- echo Logging into Docker Hub...
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
install:
runtime-versions:
docker: 18
build:
commands:
- echo Build starting on `date`
- echo Build the Docker image...
- 'sed -i "s,<\!-- COMMIT: -->,<\!-- COMMIT: $CODEBUILD_RESOLVED_SOURCE_VERSION -->,g" client/main.html'
- docker build -t $IMAGE_REPO_NAME:latest .
- docker tag $IMAGE_REPO_NAME:latest $IMAGE_REPO_NAME:$IMAGE_TAG
post_build:
commands:
- test "$CODEBUILD_BUILD_SUCCEEDING" == "1" || exit 1
- echo Pushing build to Docker Hub...
- docker push $IMAGE_REPO_NAME:latest
- docker push $IMAGE_REPO_NAME:$IMAGE_TAG
- printf '[{"name":"%s","imageUri":"%s"}]' meteor $IMAGE_REPO_NAME:$IMAGE_TAG > $CODEBUILD_SRC_DIR/imagedefinitions.json
artifacts:
files: imagedefinitions.json