diff --git a/examples/wsgi/Dockerfile b/examples/wsgi/Dockerfile index af95f3e..08d0326 100644 --- a/examples/wsgi/Dockerfile +++ b/examples/wsgi/Dockerfile @@ -2,15 +2,19 @@ FROM httpd RUN apt-get update \ && apt-get install --no-install-recommends -y \ - python3 python3-dev python3-setuptools python3-pip \ - libapr1-dev libaprutil1-dev gcc \ - && pip install mod_wsgi + python3 python3-dev python3-pip python3-venv \ + libapr1-dev libaprutil1-dev gcc -ADD examples/wsgi/requirements.txt /tmp/requirements.txt -RUN pip install -r /tmp/requirements.txt +WORKDIR /usr/local/apache2 +ADD examples/wsgi/requirements.txt /tmp/requirements.txt ADD . /tmp/latest -RUN pip install -e /tmp/latest --upgrade + +RUN python3 -m venv venv \ + && . venv/bin/activate \ + && pip install mod_wsgi \ + && pip install -r /tmp/requirements.txt \ + && pip install -e /tmp/latest --upgrade ADD examples/wsgi/httpd.conf /usr/local/apache2/conf/httpd.conf ADD examples/wsgi/app.py examples/wsgi/wsgi.py /var/flask/ diff --git a/examples/wsgi/httpd.conf b/examples/wsgi/httpd.conf index f1d4cea..41756dc 100644 --- a/examples/wsgi/httpd.conf +++ b/examples/wsgi/httpd.conf @@ -546,8 +546,8 @@ SSLRandomSeed startup builtin SSLRandomSeed connect builtin -LoadModule wsgi_module "/usr/local/lib/python3.9/dist-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-x86_64-linux-gnu.so" -WSGIPythonHome "/usr" +LoadModule wsgi_module "/usr/local/apache2/venv/lib/python3.11/site-packages/mod_wsgi/server/mod_wsgi-py311.cpython-311-x86_64-linux-gnu.so" +WSGIPythonHome "/usr/local/apache2/venv" WSGISocketPrefix /var/run/wsgi diff --git a/examples/wsgi/run_tests.sh b/examples/wsgi/run_tests.sh index a41aa06..54e6924 100755 --- a/examples/wsgi/run_tests.sh +++ b/examples/wsgi/run_tests.sh @@ -8,13 +8,13 @@ _fail() { exit 1 } -docker build -f Dockerfile -t wsgi-sample ../../. > /dev/null || _fail +docker build --platform linux/amd64 -f Dockerfile -t wsgi-sample ../../. > /dev/null || _fail docker run -d --name wsgi-sample -p 8889:80 wsgi-sample > /dev/null || _fail echo 'Waiting for the server to start...' for _ in $(seq 1 10); do - if curl -fs http://localhost:8889/ping > /dev/null; then + if curl --max-time 1 -fs http://localhost:8889/ping > /dev/null; then break else sleep 0.2