From 26dd1a5d5739a43c9dd6ce7edfe04805f1c18328 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Thu, 11 Oct 2018 22:28:01 +0200
Subject: [PATCH] Compile uwsgi with graylog2 plugin

JIRA INFRA-576 #action In Progress
---
 Dockerfile                 | 12 +++++++++++-
 requirements-to-freeze.txt |  1 -
 requirements.txt           |  1 -
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 43ca107..5e1467e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,6 +19,7 @@ RUN apt-get update \
     libgdbm-dev \
     liblzma-dev \
     libncursesw5-dev \
+    libpcre3-dev \
     libpng-dev \
     libpq-dev \
     libreadline-dev \
@@ -33,6 +34,12 @@ RUN apt-get update \
   && apt-get clean \
   && rm -rf /var/lib/apt/lists/*
 
+# Compile uwsgi with graylog2 plugin
+RUN wget https://projects.unbit.it/downloads/uwsgi-2.0.17.1.tar.gz \
+  && tar xfz uwsgi-2.0.17.1.tar.gz \
+  && cd uwsgi-2.0.17.1 \
+  && UWSGI_EMBED_PLUGINS=graylog2 python uwsgiconfig.py --build
+
 COPY requirements.txt /requirements.txt
 RUN python -m venv /venv \
   && . /venv/bin/activate \
@@ -48,8 +55,9 @@ RUN groupadd -r -g 1000 csi \
   && useradd --no-log-init -r -g csi -u 1000 csi
 
 COPY --chown=csi:csi --from=builder /venv /venv
+COPY --chown=csi:csi --from=builder /uwsgi-2.0.17.1/uwsgi /venv/bin/uwsgi
 
-# Install libraries for psycopg2 and pillow
+# Install libraries for psycopg2, pillow and uwsgi
 # Shall be the same as the one linked to when compiling in builder image!
 RUN apt-get update \
   && apt-get install -yq --no-install-recommends \
@@ -57,6 +65,8 @@ RUN apt-get update \
     libpng16-16 \
     libtiff5 \
     libpq5 \
+    libpcre3 \
+    zlib1g \
   && apt-get clean \
   && rm -rf /var/lib/apt/lists/*
 
diff --git a/requirements-to-freeze.txt b/requirements-to-freeze.txt
index 336128f..ab3c21d 100644
--- a/requirements-to-freeze.txt
+++ b/requirements-to-freeze.txt
@@ -18,7 +18,6 @@ pyjwt
 python-dateutil
 pyyaml
 qrcode
-uwsgi
 whitenoise
 ansible-tower-cli
 raven
diff --git a/requirements.txt b/requirements.txt
index c3ff3a8..ff9c289 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -48,7 +48,6 @@ sqlalchemy-citext==1.3.post0
 SQLAlchemy-Continuum==1.3.6
 SQLAlchemy-Utils==0.33.3
 urllib3==1.23
-uWSGI==2.0.17.1
 Werkzeug==0.14.1
 whitenoise==3.3.1
 WTForms==2.1
-- 
GitLab