From 8ffffdd7748e8df768d4178461734fa4e5e1df7e Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Fri, 22 Nov 2024 12:19:45 -0600 Subject: [PATCH] Experimental pypy2+uwsgi container --- uwsgi/Dockerfile | 23 +++++++++++++++++++++++ uwsgi/Makefile | 13 +++++++++++++ uwsgi/uwsgi.ini | 15 +++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 uwsgi/Dockerfile create mode 100644 uwsgi/Makefile create mode 100644 uwsgi/uwsgi.ini diff --git a/uwsgi/Dockerfile b/uwsgi/Dockerfile new file mode 100644 index 0000000..22626d3 --- /dev/null +++ b/uwsgi/Dockerfile @@ -0,0 +1,23 @@ +FROM alpine:edge AS builder + +RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ pypy musl-dev linux-headers gcc +RUN pypy -m ensurepip +RUN pypy -m pip install --upgrade --no-warn-script-location pip wheel +RUN pypy -m pip install --no-warn-script-location uwsgi + +FROM alpine:edge + +RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ pypy +COPY --from=builder /usr/lib/pypy /usr/lib/pypy + +# user `uwsgi` should be created with PID=100:GID=101 +RUN addgroup -S uwsgi +RUN adduser -SD -h /var/www -s /sbin/nologin -G uwsgi -g uwsgi uwsgi + +USER uwsgi +WORKDIR /var/www +COPY --chown=uwsgi:uwsgi uwsgi.ini /var/www/uwsgi.ini + +EXPOSE 9000 +CMD ["/usr/lib/pypy/bin/uwsgi", "--ini", "/var/www/uwsgi.ini"] + diff --git a/uwsgi/Makefile b/uwsgi/Makefile new file mode 100644 index 0000000..24f6240 --- /dev/null +++ b/uwsgi/Makefile @@ -0,0 +1,13 @@ +CONMAN=sudo docker + +REGISTRY=registry.intra.dominic-ricottone.com +IMAGE=uwsgi +TAG=latest + +image: + $(CONMAN) buildx build --push --progress=plain \ + --platform linux/arm64,linux/amd64 \ + --tag $(REGISTRY)/$(IMAGE):$(TAG) \ + . + +.PHONY: image diff --git a/uwsgi/uwsgi.ini b/uwsgi/uwsgi.ini new file mode 100644 index 0000000..35befbd --- /dev/null +++ b/uwsgi/uwsgi.ini @@ -0,0 +1,15 @@ +[uwsgi] +uid = uwsgi +gid = uwsgi +socket = :9000 +plugin = pypy + +chdir = /var/www +wsgi-file = /var/www/app.wsgi + +master +workers = 3 +max-requests = 200 +harakiri = 60 +die-on-term + -- 2.45.2