From 5efc4b03b61e047c58eaf2185eafc498b4cbebc6 Mon Sep 17 00:00:00 2001 From: Gunnar Schaefer Date: Wed, 22 Nov 2017 23:20:58 -0800 Subject: [PATCH] Reintroduce uWSGI --- Dockerfile | 19 +++++++++---------- docker/dev+mongo.sh | 3 +-- docker/uwsgi-config.ini | 3 +-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0e301a2ab..a752e878e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,20 @@ -FROM python:2.7-alpine3.6 as build +ARG UWSGI_VERSION="2.0.15" -RUN apk add --no-cache build-base curl +FROM python:2.7-alpine3.6 as build -WORKDIR /src/nginx-unit +RUN apk add --no-cache build-base linux-headers pcre-dev -RUN curl -L https://github.com/nginx/unit/archive/master.tar.gz | tar xz --strip-components 1 -RUN ./configure --prefix=/usr/local --modules=lib --state=/var/local/unit --pid=/var/unit.pid --log=/var/log/unit.log \ - && ./configure python \ - && make install +ARG UWSGI_VERSION +RUN pip wheel "uwsgi==$UWSGI_VERSION" FROM python:2.7-alpine3.6 as dist RUN apk add --no-cache git -COPY --from=build /usr/local/sbin/unitd /usr/local/sbin/unitd -COPY --from=build /usr/local/lib/python.unit.so /usr/local/lib/python.unit.so +ARG UWSGI_VERSION +COPY --from=build /uWSGI-$UWSGI_VERSION-cp27-cp27mu-linux_x86_64.whl /uWSGI-$UWSGI_VERSION-cp27-cp27mu-linux_x86_64.whl +RUN pip install /uWSGI-$UWSGI_VERSION-cp27-cp27mu-linux_x86_64.whl EXPOSE 80 8080 27017 @@ -30,7 +29,7 @@ RUN pip install -r requirements.txt COPY . . RUN pip install -e . -CMD ["unitd", "--control", "*:8080", "--no-daemon", "--log", "/dev/stdout"] +CMD ["uwsgi", "--ini", "docker/uwsgi-config.ini"] FROM dist as testing diff --git a/docker/dev+mongo.sh b/docker/dev+mongo.sh index 974c92838..27e8ab274 100755 --- a/docker/dev+mongo.sh +++ b/docker/dev+mongo.sh @@ -1,6 +1,5 @@ #!/usr/bin/env sh mongod & -MONGOD_PID=$! -exec unitd --control "*:8888" --no-daemon --log /dev/stdout +uwsgi --ini docker/uwsgi-config.ini diff --git a/docker/uwsgi-config.ini b/docker/uwsgi-config.ini index 53467c7ec..a401511f8 100644 --- a/docker/uwsgi-config.ini +++ b/docker/uwsgi-config.ini @@ -1,7 +1,6 @@ [uwsgi] +http = 0.0.0.0:80 wsgi-file = bin/api.wsgi -chdir=code/api -pythonpath=code/data master = True die-on-term = True processes = 4