Repository navigation
Expand file tree
/
Copy pathbuildspec.yml
More file actions
48 lines (48 loc) · 2 KB
/
Copy pathbuildspec.yml
File metadata and controls
48 lines (48 loc) · 2 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 nodejs and postgres docker images for testing...
- docker build -t codesenju/nodejs-test -f ./node_app/Dockerfile
- docker build -t codesenju/postgres-test -f ./postgres/Dockerfile
build:
commands:
- echo Build started on `date`
# Run tests with built Docker images
- echo Run react tests...
- docker run -e CI=true codesenju/nodejs-test
- echo Run nodejs tests...
- docker run -e CI=true codesenju/postgres-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 codesenju/nodejs-app ./node_app
- docker build -t codesenju/postgres-app ./postgres
# 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 codesenju/nodejs-app
- docker push codesenju/postgres-app