Skip to content

Commit 3539982

Browse files
authored
AWS CodeBuild example (#21)
* Example AWS CodeBuilld spec
1 parent bc841e2 commit 3539982

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AWS CodeBuild Image Build and Scan example
2+
3+
The example shows how you can use [AWS CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started-overview.html) to build a Docker image, then scan the image for vulnerabilities using the new Sysdig Scan Engine CLI. The build will fail if the policy evaluation fails. You can specify the `SECURE_API_TOKEN` and `SYSDIG_API_ENDPOINT` in the buildspec, however best practice would be to externalize the values in an external store as explained [here](https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-console.html#create-project-console-environment).
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AWS CodeBuild example with New Sysdig Scan Engine
2+
# Scans image for vulnerabilities; If policy evaluation fails, then build fails
3+
# Must configure required
4+
version: 0.2
5+
6+
env:
7+
variables:
8+
# Customers should configure this variable using paramater-store or secrets-manager
9+
SECURE_API_TOKEN: <your API token>
10+
SYSDIG_API_ENDPOINT: <Sysdig API endpoint for your region>
11+
12+
phases:
13+
install:
14+
commands:
15+
# Download most recent version of Sysdig CLI Scanner
16+
- curl -LO https://download.sysdig.com/scanning/bin/sysdig-cli-scanner/$(curl -L -s https://download.sysdig.com/scanning/sysdig-cli-scanner/latest_version.txt)/linux/amd64/sysdig-cli-scanner
17+
- chmod +x ./sysdig-cli-scanner
18+
pre_build:
19+
commands:
20+
# Build a simple NGINX image with an index file added
21+
- curl -LO https://raw.githubusercontent.com/nginxinc/NGINX-Demos/master/nginx-hello/index.html
22+
- |
23+
cat > Dockerfile << EOF
24+
FROM public.ecr.aws/nginx/nginx
25+
COPY index.html /usr/share/nginx/html
26+
EOF
27+
28+
build:
29+
commands:
30+
- docker build -t nginx-hello:hello1 .
31+
post_build:
32+
commands:
33+
- pwd
34+
- ./sysdig-cli-scanner --apiurl $SYSDIG_API_ENDPOINT nginx-hello:hello1

0 commit comments

Comments
 (0)