-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
31 lines (25 loc) · 996 Bytes
/
Makefile
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
SHELL=/bin/bash
# Project variables
CONTAINER_NAME ?= exploit-db-server
VERSION ?= $(shell git rev-parse HEAD)
DOCKER_REGISTRY ?= ghcr.io/openclarity
DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/$(CONTAINER_NAME)
DOCKER_TAG ?= ${VERSION}
# HELP
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
.PHONY: docker
docker: ## Build Docker image
@(echo "Building docker image...")
docker build --file ./Dockerfile --build-arg VERSION=${VERSION} \
--build-arg BUILD_TIMESTAMP=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
--build-arg COMMIT_HASH=$(shell git rev-parse HEAD) \
-t ${DOCKER_IMAGE}:${DOCKER_TAG} .
.PHONY: push-docker
push-docker: docker ## Build and Push Docker image
@echo "Publishing docker image..."
docker push ${DOCKER_IMAGE}:${DOCKER_TAG}