From 49e0b4f2aae8201a1a8bb47d57d5285306182f31 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Tue, 23 Apr 2019 14:23:47 +0200
Subject: [PATCH] Install uwsgi from PyPI

No need to compile graylog support (switched to docker gelf driver).
Even to add graylog support, installation can be done using by by
passing an env variable.

JIRA INFRA-981
---
 Dockerfile                 | 11 ++---------
 requirements-to-freeze.txt |  1 +
 requirements.txt           |  1 +
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index b56b40a..6aac4d1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
 FROM python:3.7-slim as base
 
 # Install Python dependencies in an intermediate image
-# as some requires a compiler (uwsgi)
+# as some requires a compiler (psycopg2)
 FROM base as builder
 
 # Install dependencies required to compile some Python packages
@@ -34,12 +34,6 @@ 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,zabbix python uwsgiconfig.py --build
-
 COPY requirements.txt /requirements.txt
 RUN python -m venv /venv \
   && . /venv/bin/activate \
@@ -55,9 +49,8 @@ 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, pillow and uwsgi
+# Install libraries for psycopg2 and pillow
 # 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 \
diff --git a/requirements-to-freeze.txt b/requirements-to-freeze.txt
index 316750d..4b80a1d 100644
--- a/requirements-to-freeze.txt
+++ b/requirements-to-freeze.txt
@@ -26,3 +26,4 @@ sentry-sdk
 sqlalchemy-citext
 sqlalchemy-continuum
 openpyxl
+uwsgi
diff --git a/requirements.txt b/requirements.txt
index 14e395e..7238748 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -48,6 +48,7 @@ sqlalchemy-citext==1.3.post0
 SQLAlchemy-Continuum==1.3.6
 SQLAlchemy-Utils==0.33.8
 urllib3==1.24.1
+uwsgi==2.0.18
 Werkzeug==0.14.1
 whitenoise==4.1.2
 WTForms==2.1
-- 
GitLab