DOCKER_ARGS=--network host --progress plain
POSTGRES_VERSION=13

.PHONY: all build gvm-libs gvmd gvm-postgres gsa gsad openvas-scanner http-gvm-proxy http-gvm-proxy-nginx

all: build

build: gvm-libs openvas-scanner gsa gsad gvmd gvm-postgres http-gvm-proxy http-gvm-proxy-nginx

gvm-libs:
	docker build $(DOCKER_ARGS) \
	-t gvm-libs ./gvm-libs

gvmd:
	docker build $(DOCKER_ARGS) \
		--cache-from gvm-libs:latest \
		-t gvmd ./gvmd

gvm-postgres:
	docker build $(DOCKER_ARGS) \
	--build-arg POSTGRES_VERSION=$(POSTGRES_VERSION) \
	-t gvm-postgres:$(POSTGRES_VERSION) ./gvm-postgres

gsa:
	docker build $(DOCKER_ARGS) \
		--cache-from gvm-libs:latest \
		-t gsa ./gsa

gsad:
	docker build $(DOCKER_ARGS) \
		--cache-from gvm-libs:latest \
		--cache-from gsa:latest \
		-t gsad ./gsad

openvas-scanner:
	docker build $(DOCKER_ARGS) \
	--cache-from gvm-libs:latest \
	--cache-from gvmd:latest \
	-t openvas-scanner ./openvas-scanner

http-gvm-proxy:
	docker build $(DOCKER_ARGS) \
	-t http-gvm-proxy ./http-gvm-proxy

http-gvm-proxy-nginx:
	docker build $(DOCKER_ARGS) \
	-t http-gvm-proxy-nginx ./http-gvm-proxy-nginx
