-
Notifications
You must be signed in to change notification settings - Fork 225
/
buildspec.yml
50 lines (50 loc) · 2.25 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
48
49
50
version: 0.2
phases:
install:
runtime-versions:
docker: 18
pre_build:
commands:
# Install Snyk
- echo Install Snyk
- curl -Lo ./snyk "https://github.com/snyk/snyk/releases/download/v1.210.0/snyk-linux"
- chmod -R +x ./snyk
# Snyk auth
# - ./snyk config set api="$SNYK_AUTH_TOKEN"
# Build Docker image for testing
- echo Build client and backend docker images for testing...
- docker build -t lukondefmwila/react-test -f ./client/Dockerfile.dev ./client
- docker build -t lukondefmwila/nodejs-test -f ./backend/Dockerfile.dev ./backend
build:
commands:
- echo Build started on `date`
# Run tests with built Docker images
- echo Run react tests...
- docker run -e CI=true lukondefmwila/react-test
- echo Run nodejs tests...
- docker run -e CI=true lukondefmwila/nodejs-test
# Scan Docker image with Snyk
## Client
## Run test for security vulernabilities
# - ./snyk test --severity-threshold=medium --docker lukondefmwila/react-test:latest --file=./client/Dockerfile.dev
## Setup continuous monitoring
# - ./snyk monitor --docker lukondefmwila/react-test:latest --file=./client/Dockerfile.dev
## Backend
## Run test for security vulernabilities
# - ./snyk test --severity-threshold=medium --docker lukondefmwila/nodejs-test:latest --file=./backend/Dockerfile.dev
## Setup continuous monitoring
# - ./snyk monitor --docker lukondefmwila/nodejs-test:latest --file=./backend/Dockerfile.dev
# Build the Docker images
- echo Building the production Docker image...
- docker build -t lukondefmwila/dkr-multicontainer-app-client ./client
- docker build -t lukondefmwila/dkr-multicontainer-app-backend ./backend
- docker build -t lukondefmwila/dkr-multicontainer-app-nginx ./nginx
# Log in to the Docker CLI
- echo "$DOCKER_PW" | docker login -u "$DOCKER_ID" --password-stdin
post_build:
commands:
# Take these images and push them to Docker hub
- echo Pushing the Docker images...
- docker push lukondefmwila/dkr-multicontainer-app-client
- docker push lukondefmwila/dkr-multicontainer-app-backend
- docker push lukondefmwila/dkr-multicontainer-app-nginx