From 783cdc2a3d99bd9fb8d75218d679ddb571420e98 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Wed, 2 Dec 2020 17:33:09 +0300 Subject: Docker: creating tags and pushing to AWS ECR as well. --- pkg/docker/Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/docker/Makefile') diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile index aed5b8f7..3b6c2720 100644 --- a/pkg/docker/Makefile +++ b/pkg/docker/Makefile @@ -55,13 +55,17 @@ build-%: Dockerfile.% tag-%: build-% docker tag unit:$(VERSION)-$* nginx/unit:$(VERSION)-$* + docker tag unit:$(VERSION)-$* public.ecr.aws/nginx/unit:$(VERSION)-$* push-%: tag-% docker push nginx/unit:$(VERSION)-$* + docker push public.ecr.aws/nginx/unit:$(VERSION)-$* latest: docker tag nginx/unit:$(VERSION)-full nginx/unit:latest + docker tag nginx/unit:$(VERSION)-full public.ecr.aws/nginx/unit:latest docker push nginx/unit:latest + docker push public.ecr.aws/nginx/unit:latest refresh-base: docker pull $(shell head -n 1 Dockerfile.tmpl | cut -d' ' -f 2) -- cgit From c981ac6558440f42670fc0a3d3857a3bb10e1f0a Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Thu, 24 Dec 2020 16:17:27 +0300 Subject: Packages: fixed an ability to override package version. This was broken since 00d8049418cf. --- pkg/docker/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/docker/Makefile') diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile index 3b6c2720..455e9fb1 100644 --- a/pkg/docker/Makefile +++ b/pkg/docker/Makefile @@ -3,9 +3,10 @@ include ../../version include ../shasum.mak +DEFAULT_VERSION := $(NXT_VERSION) DEFAULT_RELEASE := 1 -VERSION ?= $(NXT_VERSION) +VERSION ?= $(DEFAULT_VERSION) RELEASE ?= $(DEFAULT_RELEASE) CODENAME := buster -- cgit From df8ac184fd4c9f1e9cb10c2e3ca394e4bdae9e60 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Wed, 13 Jan 2021 22:33:14 +0300 Subject: Docker: based docker images off official languages ones. Language versions are bumped to: - python 3.9 - ruby 2.7 - go 1.15 - node 15 - perl 5.32 Removed images: - python 2.7 due to EOL - full/latest due to incompatibility with the new scheme --- pkg/docker/Makefile | 124 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 46 deletions(-) (limited to 'pkg/docker/Makefile') diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile index 455e9fb1..44fb5443 100644 --- a/pkg/docker/Makefile +++ b/pkg/docker/Makefile @@ -4,54 +4,95 @@ include ../../version include ../shasum.mak DEFAULT_VERSION := $(NXT_VERSION) -DEFAULT_RELEASE := 1 VERSION ?= $(DEFAULT_VERSION) -RELEASE ?= $(DEFAULT_RELEASE) -CODENAME := buster - -UNIT_VERSION = $(VERSION)-$(RELEASE)~$(CODENAME) - -MODULES = python2.7 python3.7 php7.3 go1.11-dev perl5.28 ruby2.5 \ - jsc11 full minimal - -MODULE_php7.3="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION}" - -MODULE_python2.7="unit=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION}" - -MODULE_python3.7="unit=$${UNIT_VERSION} unit-python3.7=$${UNIT_VERSION}" - -MODULE_go1.11-dev="unit=$${UNIT_VERSION} unit-go=$${UNIT_VERSION} gcc" - -MODULE_perl5.28="unit=$${UNIT_VERSION} unit-perl=$${UNIT_VERSION}" - -MODULE_ruby2.5="unit=$${UNIT_VERSION} unit-ruby=$${UNIT_VERSION}" - -MODULE_jsc11="unit=$${UNIT_VERSION} unit-jsc11=$${UNIT_VERSION}" - -MODULE_full="unit=$${UNIT_VERSION} unit-php=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION} unit-python3.7=$${UNIT_VERSION} unit-perl=$${UNIT_VERSION} unit-ruby=$${UNIT_VERSION} unit-jsc11=$${UNIT_VERSION}" - -MODULE_minimal="unit=$${UNIT_VERSION}" EXPORT_DIR := $(VERSION) +MODULES ?= go jsc node perl php python ruby minimal + +VERSION_minimal ?= +CONTAINER_minimal ?= debian:buster-slim +CONFIGURE_minimal ?= +INSTALL_minimal ?= version +define COPY_minimal +endef + +VERSION_go ?= 1.15 +CONTAINER_go ?= golang:$(VERSION_go) +CONFIGURE_go ?= go --go-path=$$GOPATH +INSTALL_go ?= go-install-src libunit-install +define COPY_go +COPY --from=BUILDER /usr/lib/x86_64-linux-gnu/libunit.a /usr/lib/x86_64-linux-gnu/\n\$ +COPY --from=BUILDER /usr/include/nxt_* /usr/include/\n\$ +COPY --from=BUILDER /go/src/ /go/src/ +endef + +VERSION_jsc ?= 11 +CONTAINER_jsc ?= openjdk:$(VERSION_jsc)-jdk +CONFIGURE_jsc ?= java --jars=/usr/share/unit-jsc-common/ +INSTALL_jsc ?= java-shared-install java-install +COPY_jsc = COPY --from=BUILDER /usr/share/unit-jsc-common/ /usr/share/unit-jsc-common/ + +VERSION_node ?= 15 +CONTAINER_node ?= node:$(VERSION_node) +CONFIGURE_node ?= nodejs --node-gyp=/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp +INSTALL_node ?= node node-install libunit-install +define COPY_node +COPY --from=BUILDER /usr/lib/x86_64-linux-gnu/libunit.a /usr/lib/x86_64-linux-gnu/\n\$ +COPY --from=BUILDER /usr/include/nxt_* /usr/include/\n\$ +COPY --from=BUILDER /usr/local/lib/node_modules/unit-http/ /usr/local/lib/node_modules/unit-http/ +endef + +VERSION_perl ?= 5.32 +CONTAINER_perl ?= perl:$(VERSION_perl) +CONFIGURE_perl ?= perl +INSTALL_perl ?= perl-install +COPY_perl = + +VERSION_php ?= 8.0 +CONTAINER_php ?= php:$(VERSION_php)-cli +CONFIGURE_php ?= php +INSTALL_php ?= php-install +COPY_php = RUN ldconfig + +VERSION_python ?= 3.9 +CONTAINER_python ?= python:$(VERSION_python) +CONFIGURE_python ?= python --config=/usr/local/bin/python3-config +INSTALL_python ?= python3-install +COPY_python = + +VERSION_ruby ?= 2.7 +CONTAINER_ruby ?= ruby:$(VERSION_ruby) +CONFIGURE_ruby ?= ruby +INSTALL_ruby ?= ruby-install +COPY_ruby = RUN gem install rack + default: @echo "valid targets: all build dockerfiles push tag export clean" -dockerfiles: $(addprefix Dockerfile., $(MODULES)) -build: refresh-base $(addprefix build-,$(MODULES)) -tag: $(addprefix tag-,$(MODULES)) -push: $(addprefix push-,$(MODULES)) latest -export: $(addsuffix .tar.gz,$(addprefix $(EXPORT_DIR)/nginx-unit-$(VERSION)-,$(MODULES))) $(addsuffix .tar.gz.sha512, $(addprefix $(EXPORT_DIR)/nginx-unit-$(VERSION)-,$(MODULES))) +MODVERSIONS = $(foreach module,$(MODULES),$(module)$(VERSION_$(module))) + +modname = $(shell echo $1 | /usr/bin/tr -d '.01234567890-') + +dockerfiles: $(addprefix Dockerfile., $(MODVERSIONS)) +build: $(addprefix build-,$(MODVERSIONS)) +tag: $(addprefix tag-,$(MODVERSIONS)) +push: $(addprefix push-,$(MODVERSIONS)) +export: $(addsuffix .tar.gz,$(addprefix $(EXPORT_DIR)/nginx-unit-$(VERSION)-,$(MODVERSIONS))) $(addsuffix .tar.gz.sha512, $(addprefix $(EXPORT_DIR)/nginx-unit-$(VERSION)-,$(MODVERSIONS))) Dockerfile.%: ../../version @echo "===> Building $@" - cat Dockerfile.tmpl | sed \ - -e 's,@@UNITPACKAGES@@,$(MODULE_$*),g' \ - -e 's,@@UNIT_VERSION@@,$(UNIT_VERSION),g' \ + cat template.Dockerfile | sed \ + -e 's,@@VERSION@@,$(VERSION),g' \ + -e 's,@@CONTAINER@@,$(CONTAINER_$(call modname, $*)),g' \ + -e 's,@@CONFIGURE@@,$(CONFIGURE_$(call modname, $*)),g' \ + -e 's,@@INSTALL@@,$(INSTALL_$(call modname, $*)),g' \ + -e 's,@@COPY@@,$(COPY_$(call modname, $*)),g' \ > $@ build-%: Dockerfile.% + docker pull $(CONTAINER_$(call modname, $*)) docker build --no-cache -t unit:$(VERSION)-$* -f Dockerfile.$* . tag-%: build-% @@ -62,15 +103,6 @@ push-%: tag-% docker push nginx/unit:$(VERSION)-$* docker push public.ecr.aws/nginx/unit:$(VERSION)-$* -latest: - docker tag nginx/unit:$(VERSION)-full nginx/unit:latest - docker tag nginx/unit:$(VERSION)-full public.ecr.aws/nginx/unit:latest - docker push nginx/unit:latest - docker push public.ecr.aws/nginx/unit:latest - -refresh-base: - docker pull $(shell head -n 1 Dockerfile.tmpl | cut -d' ' -f 2) - $(EXPORT_DIR): mkdir -p $@ @@ -80,10 +112,10 @@ $(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz: $(EXPORT_DIR) tag-% $(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz.sha512: $(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz $(SHA512SUM) $< | sed 's,$(EXPORT_DIR)/,,' > $@ -all: $(addprefix Dockerfile., $(MODULES)) +all: $(addprefix Dockerfile., $(MODVERSIONS)) clean: - rm -f $(addprefix Dockerfile., $(MODULES)) + rm -f $(addprefix Dockerfile., $(MODVERSIONS)) rm -rf $(EXPORT_DIR) -.PHONY: default all build dockerfiles latest push tag export clean refresh-base +.PHONY: default build dockerfiles push tag export clean -- cgit From d4d704bc7f37f457a50b1226165d827a3c2b25e1 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Tue, 2 Feb 2021 16:46:10 +0300 Subject: Docker: reverted 44154b830401. Automatic synchronisation is now set up, so manual pushes to AWS ECR are discouraged. --- pkg/docker/Makefile | 2 -- 1 file changed, 2 deletions(-) (limited to 'pkg/docker/Makefile') diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile index 44fb5443..00625526 100644 --- a/pkg/docker/Makefile +++ b/pkg/docker/Makefile @@ -97,11 +97,9 @@ build-%: Dockerfile.% tag-%: build-% docker tag unit:$(VERSION)-$* nginx/unit:$(VERSION)-$* - docker tag unit:$(VERSION)-$* public.ecr.aws/nginx/unit:$(VERSION)-$* push-%: tag-% docker push nginx/unit:$(VERSION)-$* - docker push public.ecr.aws/nginx/unit:$(VERSION)-$* $(EXPORT_DIR): mkdir -p $@ -- cgit