summaryrefslogtreecommitdiffhomepage
path: root/pkg/docker/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/docker/Makefile')
-rw-r--r--pkg/docker/Makefile137
1 files changed, 73 insertions, 64 deletions
diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile
index b08e885f..cb801253 100644
--- a/pkg/docker/Makefile
+++ b/pkg/docker/Makefile
@@ -6,114 +6,123 @@ include ../shasum.mak
DEFAULT_VERSION := $(NXT_VERSION)
VERSION ?= $(DEFAULT_VERSION)
+PATCHLEVEL ?= 1
-EXPORT_DIR := $(VERSION)
+MODULES ?= go jsc node perl php python ruby
-MODULES ?= go jsc node perl php python ruby minimal
+VARIANT ?= bullseye
-VERSION_minimal ?=
-CONTAINER_minimal ?= debian:bullseye-slim
+VERSIONS_minimal ?=
+CONTAINER_minimal ?= debian:$(VARIANT)-slim
CONFIGURE_minimal ?=
INSTALL_minimal ?= version
-define COPY_minimal
-endef
+RUN_minimal ?= /bin/true
-VERSION_go ?= 1.19
-CONTAINER_go ?= golang:$(VERSION_go)
+VERSIONS_go ?= 1.20
+VARIANT_go ?= $(VARIANT)
+$(foreach goversion, $(VERSIONS_go), $(eval CONTAINER_go$(goversion) = golang:$(goversion)-$(VARIANT_go)))
CONFIGURE_go ?= go --go-path=$$GOPATH
INSTALL_go ?= go-install-src libunit-install
-define COPY_go
-COPY --from=BUILDER /usr/lib/\*-linux-gnu/libunit.a /tmp/\n\$
-COPY --from=BUILDER /usr/include/nxt_* /usr/include/\n\$
-COPY --from=BUILDER /go/src/ /go/src/
-endef
-
-VERSION_jsc ?= 11
-CONTAINER_jsc ?= eclipse-temurin:$(VERSION_jsc)-jdk
+RUN_go ?= /bin/true
+
+VERSIONS_jsc ?= 11
+VARIANT_jsc ?= jammy
+$(foreach jscversion, $(VERSIONS_jsc), $(eval CONTAINER_jsc$(jscversion) = eclipse-temurin:$(jscversion)-jdk-$(VARIANT_jsc)))
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/
+RUN_jsc ?= /bin/true
-VERSION_node ?= 18
-CONTAINER_node ?= node:$(VERSION_node)
+VERSIONS_node ?= 18
+VARIANT_node ?= $(VARIANT)
+$(foreach nodeversion, $(VERSIONS_node), $(eval CONTAINER_node$(nodeversion) = node:$(nodeversion)-$(VARIANT_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/\*-linux-gnu/libunit.a /tmp/\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.36
-CONTAINER_perl ?= perl:$(VERSION_perl)
+RUN_node ?= /bin/true
+
+VERSIONS_perl ?= 5.36
+VARIANT_perl ?= $(VARIANT)
+$(foreach perlversion, $(VERSIONS_perl), $(eval CONTAINER_perl$(perlversion) = perl:$(perlversion)-$(VARIANT_perl)))
CONFIGURE_perl ?= perl
INSTALL_perl ?= perl-install
-COPY_perl =
+RUN_perl ?= /bin/true
-VERSION_php ?= 8.1
-CONTAINER_php ?= php:$(VERSION_php)-cli
+VERSIONS_php ?= 8.2
+VARIANT_php ?= cli-$(VARIANT)
+$(foreach phpversion, $(VERSIONS_php), $(eval CONTAINER_php$(phpversion) = php:$(phpversion)-$(VARIANT_php)))
CONFIGURE_php ?= php
INSTALL_php ?= php-install
-COPY_php = RUN ldconfig
+RUN_php ?= ldconfig
-VERSION_python ?= 3.11
-CONTAINER_python ?= python:$(VERSION_python)
+VERSIONS_python ?= 3.11
+VARIANT_python ?= $(VARIANT)
+$(foreach pythonversion, $(VERSIONS_python), $(eval CONTAINER_python$(pythonversion) = python:$(pythonversion)-$(VARIANT_python)))
CONFIGURE_python ?= python --config=/usr/local/bin/python3-config
INSTALL_python ?= python3-install
-COPY_python =
+RUN_python ?= /bin/true
-VERSION_ruby ?= 3.1
-CONTAINER_ruby ?= ruby:$(VERSION_ruby)
+VERSIONS_ruby ?= 3.2
+VARIANT_ruby ?= $(VARIANT)
+$(foreach rubyversion, $(VERSIONS_ruby), $(eval CONTAINER_ruby$(rubyversion) = ruby:$(rubyversion)-$(VARIANT_ruby)))
CONFIGURE_ruby ?= ruby
INSTALL_ruby ?= ruby-install
-COPY_ruby = RUN gem install rack
+RUN_ruby ?= gem install rack
default:
- @echo "valid targets: all build dockerfiles push tag export clean"
+ @echo "valid targets: all build dockerfiles library clean"
-MODVERSIONS = $(foreach module,$(MODULES),$(module)$(VERSION_$(module)))
+MODVERSIONS = $(foreach module, $(MODULES), $(foreach modversion, $(shell for v in $(VERSIONS_$(module)); do echo $$v; done | sort -r), $(module)$(modversion))) minimal
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)))
+build: $(addprefix build-, $(MODVERSIONS))
-Dockerfile.%: ../../version
+Dockerfile.%: ../../version template.Dockerfile
@echo "===> Building $@"
cat template.Dockerfile | sed \
-e 's,@@VERSION@@,$(VERSION),g' \
- -e 's,@@CONTAINER@@,$(CONTAINER_$(call modname, $*)),g' \
+ -e 's,@@PATCHLEVEL@@,$(PATCHLEVEL),g' \
+ -e 's,@@CONTAINER@@,$(CONTAINER_$*),g' \
-e 's,@@CONFIGURE@@,$(CONFIGURE_$(call modname, $*)),g' \
-e 's,@@INSTALL@@,$(INSTALL_$(call modname, $*)),g' \
- -e 's,@@COPY@@,$(COPY_$(call modname, $*)),g' \
+ -e 's,@@RUN@@,$(RUN_$(call modname, $*)),g' \
> $@
build-%: Dockerfile.%
- docker pull $(CONTAINER_$(call modname, $*))
+ docker pull $(CONTAINER_$*)
docker build --no-cache -t unit:$(VERSION)-$* -f Dockerfile.$* .
-tag-%: build-%
- docker tag unit:$(VERSION)-$* nginx/unit:$(VERSION)-$*
-
-push-%: tag-%
- docker push nginx/unit:$(VERSION)-$*
-
-$(EXPORT_DIR):
- mkdir -p $@
-
-$(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz: $(EXPORT_DIR) tag-%
- docker save nginx/unit:$(VERSION)-$* | gzip > $@
-
-$(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz.sha512: $(EXPORT_DIR)/nginx-unit-$(VERSION)-%.tar.gz
- $(SHA512SUM) $< | sed 's,$(EXPORT_DIR)/,,' > $@
+library:
+ @echo "# this file is generated via https://github.com/nginx/unit/blob/$(shell git describe --always --abbrev=0 HEAD)/pkg/docker/Makefile"
+ @echo ""
+ @echo "Maintainers: Unit Docker Maintainers <docker-maint@nginx.com> (@nginx)"
+ @echo "GitRepo: https://github.com/nginx/unit.git"
+ @previous=""; \
+ for mod in $(MODVERSIONS); do \
+ echo ""; \
+ modname="$$( echo $$mod | tr -d '.0123456789-' )"; \
+ TAGS="$$mod $${mod%%.*} $$modname" ; \
+ TAGS="$$(echo $$TAGS | tr " " "\n" | sort -u -r | tr "\n" "," | sed "s/,/, /g")"; \
+ if [ "$$previous" == "$$modname" ]; then \
+ echo "Tags: $(VERSION)-$$mod, $$mod"; \
+ else \
+ if [ "$$mod" == "minimal" ]; then \
+ echo "Tags: $(VERSION)-$$mod, $${TAGS%, }, latest"; \
+ else \
+ echo "Tags: $(VERSION)-$$mod, $${TAGS%, }"; \
+ fi; \
+ fi; \
+ echo "Architectures: amd64, arm64v8"; \
+ echo "GitFetch: refs/heads/branches/packaging"; \
+ echo "GitCommit: $(shell git describe --always --abbrev=0 HEAD)"; \
+ echo "Directory: pkg/docker"; \
+ echo "File: Dockerfile.$$mod"; \
+ previous=$$(echo $$mod | tr -d '.0123456789-'); \
+ done
all: $(addprefix Dockerfile., $(MODVERSIONS))
clean:
- rm -f $(addprefix Dockerfile., $(MODVERSIONS))
- rm -rf $(EXPORT_DIR)
+ rm -f Dockerfile.*
-.PHONY: default build dockerfiles push tag export clean
+.PHONY: default build dockerfiles clean library