1*508Sthresh@nginx.com#!/usr/bin/make 2*508Sthresh@nginx.com 3*508Sthresh@nginx.comDEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \ 4*508Sthresh@nginx.com | sed -e 's/^.*"\(.*\)".*/\1/') 5*508Sthresh@nginx.comDEFAULT_RELEASE := 1 6*508Sthresh@nginx.com 7*508Sthresh@nginx.comVERSION ?= $(DEFAULT_VERSION) 8*508Sthresh@nginx.comRELEASE ?= $(DEFAULT_RELEASE) 9*508Sthresh@nginx.comCODENAME := stretch 10*508Sthresh@nginx.com 11*508Sthresh@nginx.comUNIT_VERSION = $(VERSION)-$(RELEASE)~$(CODENAME) 12*508Sthresh@nginx.com 13*508Sthresh@nginx.comMODULES = python2.7 python3.5 php7.0 go1.7-dev go1.8-dev full minimal 14*508Sthresh@nginx.com 15*508Sthresh@nginx.comMODULE_php7.0="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION}" 16*508Sthresh@nginx.com 17*508Sthresh@nginx.comMODULE_python2.7="unit=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION}" 18*508Sthresh@nginx.com 19*508Sthresh@nginx.comMODULE_python3.5="unit=$${UNIT_VERSION} unit-python3.5=$${UNIT_VERSION}" 20*508Sthresh@nginx.com 21*508Sthresh@nginx.comMODULE_go1.7-dev="unit=$${UNIT_VERSION} unit-go1.7=$${UNIT_VERSION} gcc" 22*508Sthresh@nginx.com 23*508Sthresh@nginx.comMODULE_go1.8-dev="unit=$${UNIT_VERSION} unit-go1.8=$${UNIT_VERSION} gcc" 24*508Sthresh@nginx.com 25*508Sthresh@nginx.comMODULE_full="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION} unit-python3.5=$${UNIT_VERSION}" 26*508Sthresh@nginx.com 27*508Sthresh@nginx.comMODULE_minimal="unit=$${UNIT_VERSION}" 28*508Sthresh@nginx.com 29*508Sthresh@nginx.comexport \ 30*508Sthresh@nginx.com MODULE_python2.7 \ 31*508Sthresh@nginx.com MODULE_python3.5 \ 32*508Sthresh@nginx.com MODULE_php7.0 \ 33*508Sthresh@nginx.com MODULE_go1.7-dev \ 34*508Sthresh@nginx.com MODULE_go1.8-dev \ 35*508Sthresh@nginx.com MODULE_full \ 36*508Sthresh@nginx.com MODULE_minimal 37*508Sthresh@nginx.com 38*508Sthresh@nginx.comdefault: 39*508Sthresh@nginx.com @echo "valid targets: all build dockerfiles push clean" 40*508Sthresh@nginx.com 41*508Sthresh@nginx.comdockerfiles: $(addprefix Dockerfile., $(MODULES)) 42*508Sthresh@nginx.combuild: dockerfiles $(addprefix build-,$(MODULES)) 43*508Sthresh@nginx.compush: build $(addprefix push-,$(MODULES)) latest 44*508Sthresh@nginx.com 45*508Sthresh@nginx.comDockerfile.%: ../../src/nxt_main.h 46*508Sthresh@nginx.com @echo "===> Building $@" 47*508Sthresh@nginx.com cat Dockerfile.tmpl | sed \ 48*508Sthresh@nginx.com -e 's,@@UNITPACKAGES@@,$(MODULE_$*),g' \ 49*508Sthresh@nginx.com -e 's,@@UNIT_VERSION@@,$(UNIT_VERSION),g' \ 50*508Sthresh@nginx.com > $@ 51*508Sthresh@nginx.com 52*508Sthresh@nginx.combuild-%: Dockerfile.% 53*508Sthresh@nginx.com docker build -t unit:$(VERSION)-$* -f Dockerfile.$* . 54*508Sthresh@nginx.com 55*508Sthresh@nginx.compush-%: 56*508Sthresh@nginx.com docker tag unit:$(VERSION)-$* nginx/unit:$(VERSION)-$* 57*508Sthresh@nginx.com docker push nginx/unit:$(VERSION)-$* 58*508Sthresh@nginx.com 59*508Sthresh@nginx.comlatest: 60*508Sthresh@nginx.com docker tag nginx/unit:$(VERSION)-full nginx/unit:latest 61*508Sthresh@nginx.com docker push nginx/unit:latest 62*508Sthresh@nginx.com 63*508Sthresh@nginx.comall: $(addprefix Dockerfile., $(MODULES)) 64*508Sthresh@nginx.com 65*508Sthresh@nginx.comclean: 66*508Sthresh@nginx.com rm -f $(addprefix Dockerfile., $(MODULES)) 67*508Sthresh@nginx.com 68*508Sthresh@nginx.com.PHONY: default all build dockerfiles latest push clean 69