summaryrefslogtreecommitdiffhomepage
path: root/pkg/docker/Makefile
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2018-01-30 17:20:28 +0300
committerKonstantin Pavlov <thresh@nginx.com>2018-01-30 17:20:28 +0300
commit23268a1cd1878122d36d084ac2abe7d37147ae9c (patch)
tree7d4561cd6d1a3cb196fdb58d3b8be65807b71a68 /pkg/docker/Makefile
parent9cd4fdbdb78e035254e8094b5cff2155857ab764 (diff)
downloadunit-23268a1cd1878122d36d084ac2abe7d37147ae9c.tar.gz
unit-23268a1cd1878122d36d084ac2abe7d37147ae9c.tar.bz2
Introduced docker images building tools.
Diffstat (limited to 'pkg/docker/Makefile')
-rw-r--r--pkg/docker/Makefile68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile
new file mode 100644
index 00000000..904c4058
--- /dev/null
+++ b/pkg/docker/Makefile
@@ -0,0 +1,68 @@
+#!/usr/bin/make
+
+DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \
+ | sed -e 's/^.*"\(.*\)".*/\1/')
+DEFAULT_RELEASE := 1
+
+VERSION ?= $(DEFAULT_VERSION)
+RELEASE ?= $(DEFAULT_RELEASE)
+CODENAME := stretch
+
+UNIT_VERSION = $(VERSION)-$(RELEASE)~$(CODENAME)
+
+MODULES = python2.7 python3.5 php7.0 go1.7-dev go1.8-dev full minimal
+
+MODULE_php7.0="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION}"
+
+MODULE_python2.7="unit=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION}"
+
+MODULE_python3.5="unit=$${UNIT_VERSION} unit-python3.5=$${UNIT_VERSION}"
+
+MODULE_go1.7-dev="unit=$${UNIT_VERSION} unit-go1.7=$${UNIT_VERSION} gcc"
+
+MODULE_go1.8-dev="unit=$${UNIT_VERSION} unit-go1.8=$${UNIT_VERSION} gcc"
+
+MODULE_full="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION} unit-python3.5=$${UNIT_VERSION}"
+
+MODULE_minimal="unit=$${UNIT_VERSION}"
+
+export \
+ MODULE_python2.7 \
+ MODULE_python3.5 \
+ MODULE_php7.0 \
+ MODULE_go1.7-dev \
+ MODULE_go1.8-dev \
+ MODULE_full \
+ MODULE_minimal
+
+default:
+ @echo "valid targets: all build dockerfiles push clean"
+
+dockerfiles: $(addprefix Dockerfile., $(MODULES))
+build: dockerfiles $(addprefix build-,$(MODULES))
+push: build $(addprefix push-,$(MODULES)) latest
+
+Dockerfile.%: ../../src/nxt_main.h
+ @echo "===> Building $@"
+ cat Dockerfile.tmpl | sed \
+ -e 's,@@UNITPACKAGES@@,$(MODULE_$*),g' \
+ -e 's,@@UNIT_VERSION@@,$(UNIT_VERSION),g' \
+ > $@
+
+build-%: Dockerfile.%
+ docker build -t unit:$(VERSION)-$* -f Dockerfile.$* .
+
+push-%:
+ docker tag unit:$(VERSION)-$* nginx/unit:$(VERSION)-$*
+ docker push nginx/unit:$(VERSION)-$*
+
+latest:
+ docker tag nginx/unit:$(VERSION)-full nginx/unit:latest
+ docker push nginx/unit:latest
+
+all: $(addprefix Dockerfile., $(MODULES))
+
+clean:
+ rm -f $(addprefix Dockerfile., $(MODULES))
+
+.PHONY: default all build dockerfiles latest push clean