fix: remove unnecessary __init__.py creation from Dockerfiles and update gunicorn worker class to gthread

This commit is contained in:
Théophile Diot 2024-11-26 12:37:13 +01:00
parent d6fff9acff
commit ed2c5da2d5
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
7 changed files with 7 additions and 29 deletions

View file

@ -37,10 +37,7 @@ WORKDIR /usr/share/bunkerweb
RUN export MAKEFLAGS="-j$(nproc)" && \
mkdir -p deps/python && \
pip install --break-system-packages --no-cache-dir --require-hashes --ignore-installed -r /tmp/requirements-deps.txt && \
pip install --break-system-packages --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs) && \
if [ ! -f deps/python/zope/__init__.py ]; then \
touch deps/python/zope/__init__.py; \
fi # Ensure __init__.py exists to avoid import failures
pip install --break-system-packages --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs)
# Copy files
# can't exclude deps from . so we are copying everything by hand

View file

@ -33,10 +33,7 @@ WORKDIR /usr/share/bunkerweb
RUN export MAKEFLAGS="-j$(nproc)" && \
mkdir -p deps/python && \
pip install --no-cache-dir --require-hashes --ignore-installed -r /tmp/requirements-deps.txt && \
pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs) && \
if [ ! -f deps/python/zope/__init__.py ]; then \
touch deps/python/zope/__init__.py; \
fi # Ensure __init__.py exists to avoid import failures
pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs)
# Copy files
# can't exclude deps from . so we are copying everything by hand

View file

@ -44,10 +44,7 @@ RUN export MAKEFLAGS="-j$(nproc)" && \
mkdir -p deps/python && \
easy_install-3.9 pip && \
pip install --no-cache-dir --require-hashes --ignore-installed -r /tmp/requirements-deps.txt && \
pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs) && \
if [ ! -f deps/python/zope/__init__.py ]; then \
touch deps/python/zope/__init__.py; \
fi # Ensure __init__.py exists to avoid import failures
pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs)
# Copy files
# can't exclude deps from . so we are copying everything by hand

View file

@ -45,10 +45,7 @@ RUN export MAKEFLAGS="-j$(nproc)" && \
mkdir -p deps/python && \
python3 -m ensurepip --upgrade && \
python3 -m pip install --no-cache-dir --require-hashes --ignore-installed -r /tmp/requirements-deps.txt && \
python3 -m pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs) && \
if [ ! -f deps/python/zope/__init__.py ]; then \
touch deps/python/zope/__init__.py; \
fi # Ensure __init__.py exists to avoid import failures
python3 -m pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs)
# Copy files
# can't exclude deps from . so we are copying everything by hand

View file

@ -37,10 +37,7 @@ WORKDIR /usr/share/bunkerweb
RUN export MAKEFLAGS="-j$(nproc)" && \
mkdir -p deps/python && \
pip install --no-cache-dir --require-hashes --break-system-packages --ignore-installed -r /tmp/requirements-deps.txt && \
pip install --no-cache-dir --require-hashes --break-system-packages --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs) && \
if [ ! -f deps/python/zope/__init__.py ]; then \
touch deps/python/zope/__init__.py; \
fi # Ensure __init__.py exists to avoid import failures
pip install --no-cache-dir --require-hashes --break-system-packages --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs)
# Copy files
# can't exclude deps from . so we are copying everything by hand

View file

@ -37,10 +37,7 @@ WORKDIR /usr/share/bunkerweb
RUN export MAKEFLAGS="-j$(nproc)" && \
mkdir -p deps/python && \
pip install --no-cache-dir --require-hashes --ignore-installed -r /tmp/requirements-deps.txt && \
pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs) && \
if [ ! -f deps/python/zope/__init__.py ]; then \
touch deps/python/zope/__init__.py; \
fi # Ensure __init__.py exists to avoid import failures
pip install --no-cache-dir --require-hashes --force-reinstall --target deps/python $(for file in $(ls /tmp/req/requirements*.txt) ; do echo "-r ${file}" ; done | xargs)
# Copy files
# can't exclude deps from . so we are copying everything by hand

View file

@ -13,10 +13,6 @@ for deps_path in [join(sep, "usr", "share", "bunkerweb", *paths) for paths in ((
if deps_path not in sys_path:
sys_path.append(deps_path)
from gevent.monkey import patch_all
patch_all()
from passlib.totp import generate_secret
from logger import setup_logger # type: ignore
@ -58,7 +54,7 @@ pythonpath = join(sep, "usr", "share", "bunkerweb", "deps", "python")
proxy_allow_ips = "*"
casefold_http_method = True
workers = MAX_WORKERS
worker_class = "gevent"
worker_class = "gthread"
threads = int(getenv("MAX_THREADS", MAX_WORKERS * 2))
max_requests_jitter = min(8, MAX_WORKERS)
graceful_timeout = 30