nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 324 forks source link

Language Version Management Process #1048

Open cgearing opened 6 months ago

cgearing commented 6 months ago

Hi there,

Firstly, thanks for all your hard work on nginx-unit - it's fantastic!

I was just wondering if you had any documentation or decisions around when you begin providing docker image support for new versions of languages and when you stop.

Python 3.12 is available but not yet published as a Docker image, I can see there are multiple versions of Go and Node. Would you be open to a PR adding a Python 3.12 image alongside the 3.11 image or would you intend to cease providing a 3.11 image when the 3.12 image is produced?

Thanks!

tclesius commented 6 months ago

There is the possibilty to customize the language versions in Docker Images : https://unit.nginx.org/installation/#inst-lang-docker. But you need to change VERSIONS_python ?= 3.11 toVERSIONS_python ?= 3.12 in the makefile, then run make build-python3.12 VERSION_python=3.12.

callahad commented 6 months ago

Hi @cgearing! Glad you like Unit :)

We need to have a discussion Soon about formalizing our language / platform / etc. support intentions, but informally I'd certainly welcome a PR for building Python 3.12 images. Should be a one line change to pkg/docker/template.Dockerfile followed by a make dockerfiles in that directory.

ac000 commented 6 months ago

There is the possibilty to customize the language versions in Docker Images : https://unit.nginx.org/installation/#inst-lang-docker. But you need to change VERSIONS_python ?= 3.11 toVERSIONS_python ?= 3.12 in the makefile, then run make build-python3.12 VERSION_python=3.12.

You shouldn't actually need to modify the Makefile as the ?= means use this value if it's not set, so if you set it from the command line like above, it'll use those values...

These default values are what's used to generate the various docker files in that directory...

So simply doing

$ make build-python3.12 VERSIONS_python=3.12

is enough and produces a dockerfile Dockerfile.python3.12 that only differs from the Python 3.11 dockerfile in versions

diff --git a/Dockerfile.python3.11 b/Dockerfile.python3.12
index b5e81b6c..82e123b4 100644
--- a/Dockerfile.python3.11
+++ b/Dockerfile.python3.12
@@ -1,23 +1,23 @@
-FROM python:3.11-bullseye
+FROM python:3.12-bullseye

-LABEL org.opencontainers.image.title="Unit (python3.11)"
+LABEL org.opencontainers.image.title="Unit (python3.12)"
 LABEL org.opencontainers.image.description="Official build of Unit for Docker."
 LABEL org.opencontainers.image.url="https://unit.nginx.org"
 LABEL org.opencontainers.image.source="https://github.com/nginx/unit"
 LABEL org.opencontainers.image.documentation="https://unit.nginx.org/installation/#docker-images"
 LABEL org.opencontainers.image.vendor="NGINX Docker Maintainers <docker-maint@nginx.com>"
-LABEL org.opencontainers.image.version="1.31.1"
+LABEL org.opencontainers.image.version="1.32.0"

 RUN set -ex \
     && savedAptMark="$(apt-mark showmanual)" \
     && apt-get update \
     && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates mercurial build-essential libssl-dev libpcre2-dev curl pkg-config \
     && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \
     && mkdir -p /usr/src/unit \
     && cd /usr/src/unit \
-    && hg clone -u 1.31.1-1 https://hg.nginx.org/unit \
+    && hg clone -u 1.32.0-1 https://hg.nginx.org/unit \
     && cd unit \
     && NCPU="$(getconf _NPROCESSORS_ONLN)" \
     && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \
     && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \
     && LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" \
tclesius commented 6 months ago

oh!, I think there is a typo in the docs then: image

ac000 commented 6 months ago

Good catch! It should be VERSIONS_