-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuildspec.yml
47 lines (46 loc) · 1.45 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
40
41
42
43
44
45
46
47
# Build specification for building project under Amazon CodeBuild
version: 0.1
#environment_variables:
# plaintext:
phases:
install:
commands:
- mkdir /tmp/tmpsrc
- cp -r . /tmp/tmpsrc
- apt-get update
- apt-get -y install curl
- curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
- sudo apt-get install -y nodejs
- npm --version
- node --version
- docker --version
pre_build:
commands:
- echo -n "$CODEBUILD_BUILD_ID" | sed "s/.*:\([[:xdigit:]]\{7\}\).*/\1/" > /tmp/build_id.out
- printf "%s:%s" "$REPOSITORY_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out
- printf '{"tag":"%s"}' "$(cat /tmp/build_id.out)" > /tmp/build.json
- cat /tmp/build_id.out
- cat /tmp/build_tag.out
- cat /tmp/build.json
- cp /tmp/build.json /tmp/tmpsrc
- npm install
- $(aws ecr get-login --region ${AWS_REGION} --no-include-email)
build:
commands:
- npm run lint
- npm run test:ci
# - npm run validate
# - npm run security
# - /usr/local/bin/sonar-scanner -Dsonar.projectVersion=${version}
- npm shrinkwrap
- docker build --tag "$(cat /tmp/build_tag.out)" .
post_build:
commands:
- aws s3 cp --recursive --quiet --acl public-read ./reports ${REPORTS_BUCKET}
- docker push "$(cat /tmp/build_tag.out)"
- mv /tmp/tmpsrc/ .
- ls -la tmpsrc
artifacts:
files:
- '**/*'
base-directory: 'tmpsrc'