Skip to content

Commit

Permalink
add script to build docker image, update Makefile to build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Kanchwala committed Jul 31, 2020
1 parent 599a9aa commit b724edc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Makefile
@@ -1,10 +1,9 @@
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_FLAGS := -v -ldflags "-w -s"

BUILD_DIR = ./bin
BINARY_NAME = terrascan


# default
default: help

Expand All @@ -15,6 +14,7 @@ help:
@echo "build\n\tbuild terrascan binary"
@echo "cicd\n\tsimulate CI/CD pipeline locally"
@echo "clean\n\tclean up build"
@echo "docker-build\n\tbuild terrascan docker image"
@echo "gofmt\n\tvalidate gofmt"
@echo "golint\n\tvalidate golint"
@echo "gomodverify\n\tverify go modules"
Expand All @@ -38,7 +38,7 @@ clean:


# run all cicd steps
cicd: validate build test
cicd: validate build test docker-build


# run all unit and integration tests
Expand Down Expand Up @@ -77,3 +77,8 @@ staticcheck:
# run unit tests
unit-tests:
./scripts/generate-coverage.sh


# build terrascan docker image
docker-build:
./scripts/docker-build.sh
11 changes: 11 additions & 0 deletions scripts/docker-build.sh
@@ -0,0 +1,11 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
DOCKER_REPO="accurics/terrascan"
DOCKERFILE="./build/Dockerfile"

docker build -t ${DOCKER_REPO}:${GIT_COMMIT} -f ${DOCKERFILE} .

0 comments on commit b724edc

Please sign in to comment.